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
Hi ,
Our Scenario is we are having two grids.one on the LHS and other one in RHS.
LHS will display all workflows.on click of each workflow the details on RHs grid varies along with the column and data.As we want new columns on click of each workflow we are first clearing the roottable columns in the preparedatabinding method and binding the columns.
We want the functionality of retaining Size and Position.The Size is getting retained for the columns after refreshing the existing structure but the position is not retaining.
For example say we are having columns Application,Workflow,Activitydisplayname in the order and after loading the grid we have arranged Workflow to first and Activitydisplayname as 2 and Application as last.So we wnat to retain this changed order when we refresh the structure again.
Please find the sample piece of code in prepareDatabinding method which we are trying wityh no luck.
Please suggest us.
Regards,
madhavan
I have created a simple sample using the scenario you described. After selecting a row in the WebGrid #1, WebGrid #2 will load a new data source.
I have done some small modification in the technique you used in the attached sample. However, I think you could still achieve the desired result.
Hi Yousif,
I am sorry if I was not clear enough to explain about your issue.In your scenario, you add an unbound column via button click. No matter how you save or load via xml, when refresh the grid, the value/text of added column would be missing.This happened because your scenario against our lifecyle.When do refresh our IntializeDataSource should be called/triggered again (loaded data) which all the data on WebGrid would be loaded again. This caused an issue in your added column because it's unbound.
So, I don't agree if Madhavan's scenario is same like yours. In his sample, I can see that he handled the position and even the size in PrepareDataBinding (also not unbound) with correct life cycle. I think his scenario is possible to do.
Regards,Handy
Hi,
Please somebody advice on this.
Madhavan
In order to preserve the column structure and order in RefreshAll using your approach, you will need to add the column as the order in the previous WebGrid not by setting the position property. Here is the modified snippet of the PrepareDataBinding event handler:
protected void WebGrid1_PrepareDataBinding1(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e){ if (!IsPostBack || WebGrid1.FlyPostBackAction == PostBackAction.RefreshAll) { System.Collections.Generic.Dictionary<string, Unit> columnSize = new System.Collections.Generic.Dictionary<string, Unit>(); System.Collections.Generic.Dictionary<string, int> columnPosition = new System.Collections.Generic.Dictionary<string, int>(); for (int i = 0; i < WebGrid1.RootTable.Columns.Count; i++) { columnSize.Add(WebGrid1.RootTable.Columns[i].Name, WebGrid1.RootTable.Columns[i].Width); columnPosition.Add(WebGrid1.RootTable.Columns[i].Name, WebGrid1.RootTable.Columns[i].Position); } if (!(columnPosition.Count > 0)) { columnPosition.Add("Application",0); columnPosition.Add("Workflow", 1); columnPosition.Add("ActivityDisplayName", 2); } WebGrid1.RootTable.Columns.Clear(); foreach (string key in columnPosition.Keys) { WebGridColumn Col2 = new WebGridColumn(); Col2.Name = key; Col2.Bound = true; Col2.DataMember = key; WebGrid1.RootTable.Columns.Add(Col2); if (columnSize.Count > 0) Col2.Width = columnSize[Col2.Name]; } } WebGrid1.RootTable.DataMember = "skworkitem";}
Hi Glenn.
Thanks for the reply.
The logic you have mentioned is mainly for predefined columns.
In our cases (columns will vary based on the workflow selected in Left Hand side self reference grid)
We do something similar as we have a database driven grid structure configuration. We've run into several issues and InterSoft is aware of some of the limitations, like dynamically changing the grid on post back, e.g., adding a column or removing a column, or shuffling the positions, etc. See this thread for a bit of info
http://www.intersoftpt.com/Community/WebGrid/WebGrid-7---Updating-Structure-Dynamically-WorksAlmost/
I've had to do a lot of work on the actual XML structure info that gets saved/loaded myself. In some instances, any post back on the grid, i.e., sort, refresh, column move, etc. may need the page to be refreshed. We have to do that if, for example, the user ungroups a column or makes it visible again from the Select Columns column context menu. When this happens, InterSoft adds the column to the end of the gird, but we want it added back at its original assigned position.
So you'll need to override the grid and do your own work in instances where the grid just will not update what you need dynamically. In some cases, if you save the layout and then load it again, the grid will show the columns but not the data and rebinding the data source doesn't work either.
Note in the thread above, that the remainder of the conversation took place via email to support, so even though it's not listed, InterSoft is aware of the inability to dynamically configure the grid at the moment.
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