return data from on_update call

Questionsreturn data from on_update call
Sunil asked 9 years ago

Hi,

I have been using the on_after_insert and on_after_update for my data modification in the grid. I need to return an array from this function and pass this array to a javascript function. Is there any way I can do this?

1 Answers
Abu Ghufran answered 9 years ago

Hello,

The event does not auto-return any data as it's done with ajax call that uses generic json format.

You can use,

$opt["add_options"]["afterSubmit"] = "function(response) { ………. }";
$opt["edit_options"]["afterSubmit"] = "function(response) { ………. }";

$g->set_options($opt);

And return json format array from event handler that can be obtained in response var in js function.
Then you can parse json and pass to js function: jQuery.parseJSON(response.responseText)

I've not verified this flow, but this could be your solution.

Your Answer

10 + 8 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?