Hi all,
I have a master-detail grid.
after I add a new row in master grid,I want it automatically select the new added row and refresh the detail grid (rowid = new added row id).
Is this possible?
Thanks
Hello,
Following add_options setting will SELECT the newly inserted row.
$opt["add_options"]["afterComplete"] = "function (response, postdata) { r = JSON.parse(response.responseText); $('#list1').setSelection(r.id); }";
$grid->set_options($opt);
A condition that new record should come in grid list, You can sort grid to decending id, to show newly added record on top of grid.
Hi,Abu,
In this issue,
If I want to highlight the new row and I changed the code to:
$opt["add_options"]["afterComplete"] = "
function (response, postdata) {
r = JSON.parse(response.responseText);
$('#list1').setSelection(r.id);
jQuery('#'+r.id,'#list1').effect('highlight', {color:'red'}, 2000);
}";
But it do not work!
Rgds,
If you wish to show highlight effect, you can include jquery ui script, e.g.
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
And have highlight code in afterComplete:
$opt["add_options"]["afterComplete"] = "function (response, postdata) { r = JSON.parse(response.responseText); jQuery('#'+r.id,'#list1').effect('highlight', {color:'yellow'}, 2000); }";
$grid->set_options($opt);