Hi,
I'm looking for a way to save and restore the width of columns. Some of the users of my software may want to manually size some columns and when they next visit the same page, they expect the columns widths to be the same as they were last time. How would I do this?
BTW, I'm using the ASP.NET MVC wrappers.
Thanks,
Al
Thanks for the reply, but it doesn't quite work.If you don't resize a column, the value isn't set.i.e.
<resize column 0>
That's not too bad, but it leads to this...If you resize a column and other columns are automatically resized as a result, those other columns don't get have a value set:<resize column 0, columns 1 through n resize as a result>
Persisting the new column width after every resize could pose some performance overhead, and can eventually become a bottleneck in the application, since there will be an AJAX request for every resize end-user interaction. Of course, there are various alternative methods of doing this.
Angel
there is no out of the box way to achieve this. I am not sure how your application is structured, and how you submit data to the server (whether it's based on AJAX requests or you do a full page submit) - but one possible way could be to retrieve the current column width after resizing, and then serialize some custom JSON and send it to the server , then de-serialize it and apply it to the grid on the next page load.
$("#grid1).igGrid("option", "columns")[<column index>].width
that's how you can retrieve the current column width, at runtime. On resizing, the column object's width property gets changed accordingly.
You can also contact Development Support if you need more in-depth help with this scenario.
Hello alai604,
You can use Ajax post to save the column width as soon as user finishes column resizing. You should bind to igGridResizing's columnResized event.Example code:
//Bind after initialization $(document).delegate(".selector", "iggridresizingcolumnresized", function (evt, ui) { // make your ajax call here // use ui.columnIndex or ui.columnKey to identify the column // use ui.newWidth to get the new width of the column });
//Bind after initialization
$(document).delegate(".selector", "iggridresizingcolumnresized", function (evt, ui) {
// make your ajax call here
// use ui.columnIndex or ui.columnKey to identify the column
// use ui.newWidth to get the new width of the column
});
For performance reasons you should set deferredResizing property to true.
For more information on columnResized event you can check our online API documentation:
http://help.infragistics.com/jQuery/2011.2/ui.iggridresizing#events
If you need information on how to use jQuery Ajax functions:
http://api.jquery.com/jQuery.post/
Hope this helps,
Martin Pavlov
Infragistics, Inc.