Problema with grid-subgrid on change value

QuestionsProblema with grid-subgrid on change value
Javier Lopez asked 6 years ago

Good morning .
I have a master grid with a combo field , I need you on the value of the combo some data or other display in a subgrid .
That is, depending on the value of a select from the main grid , will change the select ( SQL ) of the secondary grid and the grid is updated.

Is this possible ?

Greetings and thanks .

1 Answers
Abu Ghufran answered 6 years ago

Hello,

You can bind onchange event of master grid dropdown with a JS callback function.
In that function, you will need:

1) Set dropdown value in URL querystring of grid.
2) Reload the second grid.

// connect js function with onchange event
$col["editoptions"]["onchange"] = "reload_grid2(this)";

// js callback in html part
function reload_grid2(o)
{
var v = o.value;
var old_url = jQuery('#list2').getGridParam('url');

old_url = old_url + '&val='+v;

jQuery('#list2').jqGrid('setGridParam',{url: old_url, editurl:old_url, cellurl:old_url, jqgrid_page:1});
jQuery('#list2').trigger('reloadGrid',[{jqgrid_page:1}]);
}

I've not tested this code. This is just to give some idea.

Your Answer

3 + 4 =

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?