I'm facing two issues with my current implementation of a radgrid wich uses nestedviewtemplates to show details inside multipage + formviews.
1)- First issue is that when expanding an item, even if viewstate is enabled, it seem the grid still calls the needdatasource and launch the db query. Why? Is this correct? I'm just expanding a row shouldn't it retrieve the rest of the current grid page from the controlstate/viewstate?
2)- Second issue is that... I'm using InPlace edit for the grid rows, also I'm using the grid <EditFormSettings EditFormType="Template"> for insert. What happens now is that if I have InPlace editing active on a row and I expand another row (or the same one) things get messed up with JS errors. And the same happens when the insert is active. If I do the other way round (with one or more rows expanded I go to edit InPlace or launch Insert) everything works correct since it seems that before entering InPlace or Insert the grid is rebound and all the expanded rows are closed.
Those 2 questions are somehow related since... to solve the second issue I would like to obtain on item expand the same "effect" that happens automatically when you go InPlace edit or Insert, but it seems that the grid already rebinds itself when you expand an item.
I'm a bit confused and need some help here. I solved now with a trick on client command that way: <ClientEvents OnCommand="CheckExpand" />
And in the JS code:
RepaintGrid just issues a grid.MasterTableView.Rebind()
But this is not working as intended since it ALWAYS does a rebind even when edit inplace or insert are not active. Infact I have HierarchyLoadMode="Conditional" but each time I expand or collapse a row grid is always rebind. Positive side is that it actualluy
1)- First issue is that when expanding an item, even if viewstate is enabled, it seem the grid still calls the needdatasource and launch the db query. Why? Is this correct? I'm just expanding a row shouldn't it retrieve the rest of the current grid page from the controlstate/viewstate?
2)- Second issue is that... I'm using InPlace edit for the grid rows, also I'm using the grid <EditFormSettings EditFormType="Template"> for insert. What happens now is that if I have InPlace editing active on a row and I expand another row (or the same one) things get messed up with JS errors. And the same happens when the insert is active. If I do the other way round (with one or more rows expanded I go to edit InPlace or launch Insert) everything works correct since it seems that before entering InPlace or Insert the grid is rebound and all the expanded rows are closed.
Those 2 questions are somehow related since... to solve the second issue I would like to obtain on item expand the same "effect" that happens automatically when you go InPlace edit or Insert, but it seems that the grid already rebinds itself when you expand an item.
I'm a bit confused and need some help here. I solved now with a trick on client command that way: <ClientEvents OnCommand="CheckExpand" />
And in the JS code:
// Check if edit InPlace or Insert is active before expanding grid and rebind
function
CheckExpand(sender, eventArgs) {
if
(eventArgs.get_commandName() ==
"ExpandCollapse"
) {
var
masterTable = sender.get_masterTableView();
var
item = masterTable.get_dataItems()[eventArgs.get_commandArgument()];
var
isexpand = item.get_expanded()
var
editItems = masterTable.get_editItems();
var
insertItem = masterTable.get_insertItem();
if
((editItems.length > 0 || insertItem !=
null
) && isexpand ==
false
) {
masterTable.fireCommand(
"RepaintGrid"
,
""
);
}
}
}
RepaintGrid just issues a grid.MasterTableView.Rebind()
But this is not working as intended since it ALWAYS does a rebind even when edit inplace or insert are not active. Infact I have HierarchyLoadMode="Conditional" but each time I expand or collapse a row grid is always rebind. Positive side is that it actualluy
Good news is that this fixes the issues when inplace or insert are active and I expand a grid since it "resets" the grid first removing them and then expand the row BUT in this scenario a double rebind happens (see problem number 1 above) and this is not good.
Need some help here. Thank you in advance for your usual support both Telerik staff and helpful users!
This community is great and is great to contribute somehow even with problems that when resolved are useful to anyone.
Need some help here. Thank you in advance for your usual support both Telerik staff and helpful users!
This community is great and is great to contribute somehow even with problems that when resolved are useful to anyone.