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
Hello,
Is there a way to configure the WebGrid so that it will show group rows with no items? For example, we want to enable our customers to statically group items in the grid based on certain criteria. If a particular criteria yelded no items, we'd like to be able to show that. So let's say there's a datatable of tasks, and the user wants to see the tasks based on the status: In Progress, Completed and Not Started. If there are no tasks with the Not Started status, we'd like to still show that grouping but with no items.
Thank you,
Dasha.
Hi Dahsa,
Hmm, it is weird. I have tried it and it works just fine. The image is still not showing up even after I perform a FlyPostBack, sorting or filtering. Here is the snippet.
function WebGrid1_OnResponse(controlId, status) { var WebGrid = ISGetObject(controlId); window.setTimeout(function() { for (var i = 0; i < WebGrid.RootTable.GetGroupRows().length; i++) { if (!WebGrid.RootTable.GetGroupRows()[i].GetGroupChildRows() || WebGrid. RootTable.GetGroupRows()[i].GetGroupChildRows().length == 0) { WebGrid.RootTable.GetGroupRows()[i].SetForceNoEdit(); WebGrid.RootTable.GetGroupRows()[i].RowElement.cells[0].style.displa y = "none"; } } }, 700); return true; }
I hope it helps. Thank you and have a nice day.
Best Regards,
Andi Santoso
Hi Dasha,
Sorry to tell, but, our grouping in WebGrid is grouped by the data that are rendered on its WebGrid. So if it has no data or empty, we can not have a grouped section with empty data. I hope it helps and please, do not hesitate to ask if you have any other questions. Thank you.
Hello Andi,
I believe I've been able to make some progress here. What I did was I added an empty row with just the group header into my datatable. Then i did this:
protected void ISGrid_InitializeRow(object sender, RowEventArgs e) { if (e.Row.Type == ISNet.WebUI.WebGrid.RowType.GroupHeader) { if (e.Row.Cells[0].Value.ToString() == "Not Started") { e.Row.Children.Clear(); } } }
This clears the child rows from that group, and essentialy creates an empty group with the proper cout of (0).
May last problem is how do I remove the Expand capability from this group? And how can i update the "Loaded" count at the bottom of the grid, which still counts my removed row?
Please see the attached image, note how the total count does not add up to the individual group couts.
To remove the expand capability, is by using its element and set the display to none. Here is the snippet to do so.
function WebGrid1_OnColumnGroup(controlId, columnObject) { var WebGrid1 = ISGetObject(controlId); window.setTimeout(function() { ISGetObject("WebGrid1").RootTable.GetGroupRows()[36].SetForceNoEdit(); ISGetObject("WebGrid1").RootTable.GetGroupRows()[36].RowElement.cells[0].style .display = "none"; }, 700); return true; }
And for the total count at the bottom of the WebGrid, unfortunatelly, we can not change it. Because, from what we did, actually, we do not remove or delete the data. It just hide them and that is why the Grouped row is still shown up and they are still included in the total count of data. Forgive me, but this feature is not supported by us yet. I hope it helps. Thank you.
Andi, thank you for your help. This is what I did:
function CheckEmptyGroups(controlId) { var WebGrid = ISGetObject(controlId); var groupRows = WebGrid.RootTable.GetGroupRows(); for (var i = 0; i < groupRows.length; i++) { if (!groupRows[i].GetGroupChildRows() || groupRows[i].GetGroupChildRows().length == 0) { WebGrid.RootTable.GetGroupRows()[i].SetForceNoEdit(); WebGrid.RootTable.GetGroupRows()[i].RowElement.cells[0].style.display = "none"; } } }
And I assigned this method to WebGrid's OnAfterInitialize event. This way my goups were loaded correctly when the grid was initially rendered if the groups were defined programmatically. It was working great until I noticed that the expand image is restored after any FlyPostBack event like sorting, paging, or filtering. Is there any way to 'lock' in my changes?
Unfortunately, we cannot make it as a static, since it works under a condition. So, the workaround what we might can do is, by using other client side event. I have tried on WebGrid1_OnResponse and it worked nicely. So, in this event, if every event that related to grouping is occurred, then we can start to do the validation.
I hope it helps and please do not hesitate to ask if you have any other questions. Thank you.
Thank you for your help, but it's still not working for me. The Groups are set up programmatically in code. And so the columns are grouped initially rather than by using the grouping flypostback action. When I first load the page, the 'expand' image is hidden, but once I sort a column, it is once again displayed. I tried using the OnResponce event like you suggested, but it's still not working.
I think that for simple testing you can try to set up some groups in c# codebehind and then try to hide all the expand images through javascript, not just certain ones. This way you'll see that any flypostback event will bring the expand images back.
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