cancel
Showing results for 
Search instead for 
Did you mean: 

Dashboards Direct - How to specify an error message on Data Grid edit failure

jlucid
Contributor

I have a Data Grid component with Edit mode enabled, users can only update cells, not add or delete.

In my user defined update function, which upserts the users entry, I have put in some validation checks before the upsert to ensure the values are within a given range.

If the validation fails, I return an `ERROR_MESSAGE symbol, and this prompt the Dashboard to display an

error  message in Red which says "An error occurred executing the update query: Error text: t"

 

Is there a way for me to to replace the "t" with a message corresponding to the validation check that failed?

 

Thanks

 

 

1 ACCEPTED SOLUTION

jlucid
Contributor

The solution I found for this problem was to open the file below

dash/www/modules/Datagrid_9fde571/main.js

 

And replace the line 

r=function(e){this.showMessageSubmitError(e[0])}.bind(this)     [First character being returned]

with 

r=function(e){this.showMessageSubmitError(e)}.bind(this)

 

Now when I submit an edit to the Data grid cell, and force the update function to fail (with a mock validation check),  the error message returning is showing the full error message. 

If someone else has a better solution please let me know

View solution in original post

3 REPLIES 3

jlucid
Contributor

 If I modify my update function like below, where when the if statement is true it hits an undefined variable

"BadValueInputted" then the error message on screen just shows the first character of the missing variable, the "B", so the Error message appearing on screen is " "An error occurred executing the update query: Error text: B".

Is there a way to display the full text and not truncate?

 

 

 

 

{[dgAdd;dgUpd;dgDel]
 
 if[not (first dgUpd[`Current]) in 10.0 20.0;
   BadValueInputted
 ];
$[((count dgUpd)>0);`testTable upsert flip dgUpd;];
}

 

 

jlucid
Contributor

The solution I found for this problem was to open the file below

dash/www/modules/Datagrid_9fde571/main.js

 

And replace the line 

r=function(e){this.showMessageSubmitError(e[0])}.bind(this)     [First character being returned]

with 

r=function(e){this.showMessageSubmitError(e)}.bind(this)

 

Now when I submit an edit to the Data grid cell, and force the update function to fail (with a mock validation check),  the error message returning is showing the full error message. 

If someone else has a better solution please let me know

In version, 2.1.0 I see the same issue in modules/Datagrid_b71a7f6/main.js

replacing e[0] with e does the job to show the full error message.
Please let me know if this one is being tracked or was already fixed in a patch, thanks