select the new added row

Questionsselect the new added row
Raina asked 6 years ago

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

3 Answers
Abu Ghufran answered 6 years ago

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.

Chao Shun Jenq answered 6 years ago

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,

Abu Ghufran answered 6 years ago

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);

Your Answer

3 + 9 =

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?