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
Is there a way to load the grid and have it expand automatically to a specific row based on the row key? Even if the grid can't do this via properties, how can this be accomplished programmatically on both server and client side? Thank you.
Okay, I found a way to work around the issue above which still should have worked and I'd consider it a bug. In our workaround, we were lucky in that the keys contained what we need to start expanding at the parent and work our way down.
foreach (string strKey in FoundItemKeyValueList) { // get our find target and current row's key and move its individual ids // into their own arrays so we can compare and drill down to our found // target by expanding the parent rows string[] arFoundIds = strKey.Split(','); string[] arCurrentIds = e.Row.KeyValue.ToString().Split(','); // if we match our key fully, then we're at our target so we do not need // to expand anything but we do need to select it if (strKey == e.Row.KeyValue.ToString()) { // and then select our item e.Row.Selected = true; } // if we haven't found our target yet, then expand the parent where our // target lives until we get to it. We determine this by checking // our current row against our target at the current level which would // have the same key IDs else if (arFoundIds[e.Row.SelfRefLevel] == arCurrentIds[e.Row.SelfRefLevel]) { e.Row.ExpandSelfRefRow(); } }
Hi Yousif,
If you want to expand the row when loading WebGrid, I suggest you to handle the code at InitializeRow serverside event.
e.g... some KeyValue are not in string object. So, sometimes, you will need to convert into string.
protected void WebGrid1_InitializeRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e) { if (e.Row.KeyValue.ToString() == "1") { e.Row.ExpandSelfRefRow(); } }
Regards,Handy
Great, thank you Handy. I'll give this a try today and see how it goes.
Handy,
This is working but not as expected. Unfortunately, it's not expanding the entire levels above the item. For example, if I have the following:
- Item 1 - Item 1-1 + Item 1-1-1 - Item 1-1-2 Item 1-1-2-1 + Item 1-2
+ Item 1 Item 1-1-2-1 + Item 1-2
I tried the following code to expand everything going up in the InitializeRow override but it does not work:
if (strKey == e.Row.KeyValue.ToString()) { // select our item e.Row.Selected = true; // expand all the rows from the bottom up WebGridRow oWorkRow = e.Row.SelfRefParentRow; while (oWorkRow != null) { oWorkRow.ExpandSelfRefRow(); oWorkRow = oWorkRow.SelfRefParentRow; } }
How can I get the grid to expand all the parents too?
Hello,
Thank you for your feedback. Unfortunately, it is not a bug. The current method can only open SelfRefRow in one level, not all SelfRefRow include the child.
Hello,Thank you for your feedback. Unfortunately, it is not a bug. The current method can only open SelfRefRow in one level, not all SelfRefRow include the child. Regards,Handy
Would you kindly submit it as a feature request please? It would really be helpful to not have to do this programmatically, i.e., when you select a specific node to expand, it should, when rendered, have its parents expanded too. That behavior, at least to me, seems to be the obvious one and is what I had expected. Thanks a lot.
Sure, I will create a wi for this feature request.
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