|
Title: [SOLVED] Datagrid column same width depending on longest title Post by: jega on October 12, 2024, 11:47:47 AM HI.
Can't find anythig about this. Have a datagrid with dynamic columns. How can i set the width to alle columns depending on the longest header title. Jesper Title: Re: Datagrid column same width depending on longest title Post by: jega on October 14, 2024, 02:00:18 AM One solution
var colWidth = 0; $.each(scrollCols, function(index, element) { if ($('#'+element.id).width() > colWidth){colWidth = $('#'+element.id).width()} }); $.each(scrollCols, function(index, element) { $('#'+element.id).css('width',colWidth); }); BUT, is there a better way to do it ?? Title: Re: Datagrid column same width depending on longest title Post by: jarry on October 15, 2024, 07:15:36 PM Here is the extended method to achieve this functionality.
Code: $.extend($.fn.datagrid.methods, {Code: $('#dg').datagrid('setSameColumnWidth')Title: Re: Datagrid column same width depending on longest title Post by: jega on October 16, 2024, 12:07:35 AM Hi jarry
Thanks. Works fine. Any way to revert it without reload ?? |