I have an application where the user has the ability to save multiple layouts. By default I save a single default layout in the DB. The first time the user logs in, the default layout is used. However this causes a delay in loading.
Each grid in my application has what we call a RepNumber. The filterrow contains the column for repname, which is tied to the repnumber. What I would like to do is create a layout for each user when I save the default layout for the first time.
How can I take an existing layout and create a default that is catered to each specific user? Also, when ever a new user is added to the system, I would need to create the default layout records for that user.
My initial thoughts where to have the db triggers perform these function, but I dont know how to add filters to an existing layout.
By the way I am serializing the layouts with XML...
Thanks
HI Elfmanne,
I created a sample application that creates several different wingrid layouts, each with different filtering conditions. I then apply these layouts to several different grids.
Here is a code snippet to create the layouts with different filtering
UltraGridBand band = ultraGrid1.DisplayLayout.Bands[0]; band.ColumnFilters[0].FilterConditions.Add(FilterComparisionOperator.Equals, 2); ultraGrid1.DisplayLayout.SaveAsXml("Acct2.xml");
band.ColumnFilters[0].ClearFilterConditions(); band.ColumnFilters[0].FilterConditions.Add(FilterComparisionOperator.Equals, 3); ultraGrid1.DisplayLayout.SaveAsXml("Acct3.xml");
Here is a code snippet load the layouts
ultraGrid2.DisplayLayout.LoadFromXml("Acct2.xml"); ultraGrid3.DisplayLayout.LoadFromXml("Acct3.xml"); ultraGrid4.DisplayLayout.LoadFromXml("Acct4.xml"); ultraGrid5.DisplayLayout.LoadFromXml("Acct5.xml");
The sample project is too large to attach to this forum post. I will email it to you directly.
Please review my sample application. You will need to readd the Infragistics references to run this project.
Sincerely,
Matt
Developer Support Engineer
Matt,
My requirements require this to be a little more dynamic. As I said before the event that would trigger this is the insert of the default layout record into the DB. This would be rather easy, however this is a product that we sell, thousands of companies and even more users.
That being said, what I really need is a way to TRIGGER off the insert of the initial default records into the DB. This record would be created during database migration or the insert of a new rep. From what I can tell I would need to clone this record for each REP, adding the additional filter into the XML of the default record and saving it into the REP specific table where I store the REPS filters.
My question then is how to interject a new filter criteria directly into the default filter XML?
HI,
Just following up on our forum thead.
I hope my sample resolved your issue regarding the multiple layouts with different filtering.
If you have additional questions regarding this issue, please let me know .