jQWidgets Forums
jQuery UI Widgets › Forums › Grid › jqxGrid autoresizecolumns after loading data
Tagged: angular grid, autoresizecolumns, bootstrap grid, grid, javascript grid, jquery grid, jqwidgets grid, jqxgrid
This topic contains 6 replies, has 4 voices, and was last updated by Hristo 8 years, 8 months ago.
-
Author
-
Hello! I can’t find the way to change columns width automatically after loading data. I’ve tried to do it with event ‘bindingcomplete’, but it doesn’t work, it seems that binding is finished before data is passed to grid, and I have error “Uncaught TypeError: Cannot read property ‘length’ of undefined”. Can you show me a way to set width to auto.
Thaks!Hello igard,
You can use ‘render’ function. The following example shows how to use it. This function is called when the grid is initialized and the binding is complete.
$("#jqxgrid").jqxGrid( { source: source, ready: function() { $('#jqxgrid').jqxGrid('autoresizecolumn', 'lastname'); } });
Best Regards,
NadezhdajQWidgets team
http://www.jqwidgets.com/Thank you! It works!
Hi ,
I have applied autoresize but grid width is not taking 100%, initially it took 1005 of div but after applying autoresize property the width is getting shrinked,
you can see here http://jsfiddle.net/jqwidgets/ZyaQF/ , just add with ‘100%’ and check after clicking “Auto-Resize Columns”..
So any even after applying auto-resize , how can I maintain 100% width??
Hello fresher,
I am not sure that I understand you correctly.
Please, take a look this example:
http://jsfiddle.net/txhi/j28wp351/Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comHi Hristo,
Thanks for the reply,
Here I’m getting a horizontal scroll bar which is not acceptable for us.
I would like to autoresize only based on grid column Content i.e data not by column header text.
If the column header text is more and data is only 2 digits then column should take only 2digits width and header text should get WRAPPED.
Hello fresher,
If I understand you correctly you could try to use
$('#jqxgrid').jqxGrid('autoresizecolumns', 'cells');
with optional parameter cells.
Another optional parameters are “all”, “cells” or “column” you could find out more in our API Documentation.Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.