Double click the subgrid, opens 2 edit dialogs: master and subgrid

QuestionsDouble click the subgrid, opens 2 edit dialogs: master and subgrid
E Mello asked 8 years ago

Hi,
When I double click the subgrid row, it opens 2 edit dialogs: one for the subgrid row and the other for the record related in the master grid.
I would like to open only the edit dialog for the subgrid row.
It would be great to disable the double click action in the subgrid and keep it on the master grid.
Let me know if you've got any thoughts.
Many thanks.

2 Answers
Abu Ghufran answered 8 years ago

To have double click event binded on one grid, e.g. list1, you can have var as opts_list1 (where list1 is grid id)

<script>
var opts_list1 = {
'ondblClickRow': function (id) {
jQuery(this).jqGrid('editGridRow', id, <?php echo json_encode_jsfunc($g->options["edit_options"])?>);
}
};
</script>

E Mello answered 8 years ago

The issue was, when you double click subgrid, it was invoking event for subgrid as well as master grid (because subgrid was inside master grid's td)
Solution was to stop the event propagation when dblclicked on subgrid row.

<script>
var grid_id = <?php echo $c_id;?>;
var grid = $("#_list1_"+grid_id);

var opts_<?php echo $g->id?> = {
'ondblClickRow': function (id,row,col,e) {
jQuery(grid).jqGrid('editGridRow', id, <?php echo json_encode_jsfunc($g->options["edit_options"])?>);
e.stopImmediatePropagation();
}
};

</script>

Your Answer

11 + 11 =

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?