Dear all,
I use Radgrid with popup window. I want to implement specific scenario. My item has relations to different tables and I can add/modify them only when item is created (otherwise I don't have primary key). My idea is: when I insert new item I want to save it and automatically open the same item in edit mode. It means user can continue to create additional relations and it is not necessary to find new item in grid and start edit mode.
Can you help me if it is possible and how to implement it?
Thank you,
Petr
4 Answers, 1 is accepted
In the meantime I found another post which is helpful for me. During insert I store key values for inserted record. Then during preRender method I find correct row and I set GridItem.Edit = true and call RadGrid.Rebind().
It shows update dialog with my inserted values, but it looks there is still missing some initialization. I see that command "Edit" is not invoked. When I click Update button then dialog is closed, but grid is lost and nothing is updated. Command "Update" is not invoked too.
Maybe rebind method must be call later or any other initialization must be called. Do you have any idea what is wrong?
Thanks
I solved the problem. At the end I only set selected new record in grid and I register new startup script which start edit for selected item.
function
openEditWindow() {
var
masterTable = $find($(
'[id$="RadGrid1"]'
).attr(
'id'
)).get_masterTableView();
var
editItems = masterTable.get_selectedItems();
if
(editItems.length > 0)
window.setTimeout(
function
() {
masterTable.editItem(editItems[0].get_element());
}, 0);
}
It looks as the best solution for me.
I'm glad you've found a viable solution for your specific scenario.
You can also achieve this requirement by determining the position of the newly inserted row, as explained in the following post:
http://www.telerik.com/forums/select-inserted-updated-row-after-performing-command#UqPp6075pUO9rOJsy-RmIw
Regards,
Eyup
Telerik by Progress
I don't find this post, but I already implemented something like that. I also use SQL query to find correct row index. I saw that using 2 rebinds is not workable for my grid which contains over 7500 rows on 75 pages.
Thanks,
Petr