iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
i found sample code in help document about client function "ExpandGroupRow",
btnExpandGR.disabled = true; btnCollapseGR.disabled = false;
but i use this code, show javascript error "btnExpandGR not define", when i remove this code, ExpandGroupRow function not work. why?
thanks
Hello Roger,
In documentation, the code is refer to WebGridTutorials project. In WebGridTutorials project, btnExpandGR and btnCollapseGR are variables that holds button object. If you want to use it, you should create buttons with ID then you can declare that buttons in javascript using this statement:
var btnExpandGR = document.getElementById(“btnExpandGR”);//ID of 1st button is “btnExpandGR”
var btnCollapseGR = document.getElementById(“btnCollapseGR”);//ID of 2nd button is “btnCollapseGR”
Then “btnExpandGR” and “btnCollapseGR” are declared.
When you remove the code, ExpandGroupRow function not working because you don’t have any event that trigger this function. If that code removed from function, the function is still working but it wouldn't working properly.
For references, you can see our WebGridTutorials on V4.0/Programmatic_UI.aspx.
*Start Menu > Intersoft WebUI Studio 2011 R2 SP1 > WebUI Studio for ASP.NET > WebGrid 7 > C# Tutorials (Visual Studio 2010 Solution)
Expand V4.0 folder and open the Programmatic_UI.aspx
thanks, i want to restore the group nodes state when after sort or refresh, my code is
function wg_expense_GroupExpand(controlId, tblName, groupIndex, rowPosition, rowIndex) { StoreExpandedGroupNode(rowPosition, true); return true; } function wg_expense_GroupCollapse(controlId, tblName, groupIndex, rowPosition, rowIndex) { StoreExpandedGroupNode(rowPosition, false); return true; } function wg_expense_AfterResponseProcess(controlId, actionName, lastRequestObject, xmlResponseObject) { var grid = ISGetObject(controlId); //if ColumnSort or Refresh action or LoadGroup or ColumnFilter, restore the group nodes state if (actionName == "Refresh" || actionName == "ColumnSort" || actionName == "LoadGroup" || actionName == "ColumnFilter") { var v_expandedGroupNodes = document.all["hid_expandedGroupNodes"]; if (v_expandedGroupNodes.value != "") { var RowInfo = v_expandedGroupNodes.value.split(";"); for (var i = 0; i < RowInfo.length; i++) { var Row = RowInfo[i]; var groupRow = grid.RootTable.GetRowByGroup(0, Row) if (!groupRow.GroupExpanded) { groupRow.ExpandGroupRow(); //btnExpandGR.disabled = true; here need some code insure effect //btnCollapseGR.disabled = false; } } } } return true; } function StoreExpandedGroupNode(RowIndex, action) { var v_expandedGroupNodes = document.all["hid_expandedGroupNodes"]; if (action) { // Expanded if (v_expandedGroupNodes.value == "") v_expandedGroupNodes.value = RowIndex; else { // not exist,need add。 if (!groupRowExist(v_expandedGroupNodes.value, RowIndex)) v_expandedGroupNodes.value += ";" + RowIndex; } } else { //obtain the information about RowPosition delimited by ";" var RowInfo = v_expandedGroupNodes.value.split(";"); var expandedGroupNodesTemp = ""; //compare it with current RowIndex of collapsed group node for (var i = 0; i < RowInfo.length; i++) { var Row = RowInfo[i]; if (RowIndex != Row) { if (expandedGroupNodesTemp == "") expandedGroupNodesTemp = RowInfo[i]; else expandedGroupNodesTemp += ";" + RowInfo[i]; } } v_expandedGroupNodes.value = expandedGroupNodesTemp; } } // function groupRowExist(expandedGroupNodes, RowIndex) { var v_exist = false; var RowInfo = expandedGroupNodes.split(";"); for (var i = 0; i < RowInfo.length; i++) { var Row = RowInfo[i]; // if (RowIndex == Row) { v_exist = true; break; } } return v_exist; }
so I don't understand "ExpandGroupRow function not working because you don’t have any event that trigger this function",
Hello,
Unfortunately, it cannot be done for now. Restore state expand/collapse only can be done in hierarchical, not grouping.
However, it might be be sorted out with code. But the effort is too big.
Example, I attached my sample about this scenario.I hope you can have an idea how to do it.
In my sample, the state can be restored when refresh or sort the column inside group.
However, it still lacks of some cases such as filtering and sorting the group column.
Based on this experience, I suggest to have this as a feature request because it would be more elegant way to achieve this scenario.
bernard, thanks for you reply. i remove code remarks.
(!groupRow.GroupExpanded) { groupRow.ExpandGroupRow(); btnExpandGR.disabled = true }
then set IE ignore javascript error, it can be good in my scenario. hope the next version has this feature.
Regards,Roger
Hi,
We have added this on feature request.
I will let you know any news I hear from the team regarding this feature request.
Regards,
Bernard
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname