Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
510
igGrid's double click 'AutoFit' columns
posted

Hi,

I was wondering if there is a way to have AutoFit take into account the column's header text and not just the data? For example if a user double clicks a column with a header text of "Product ID" to AutoFit that column but the column has data like "1", "2", "3", "4", the column will resize to AutoFit the data and the column text will basically become non-visible.

Here is a JSFiddle: http://jsfiddle.net/0ctqyw3j/

So, if you double click on the "Product ID" column to resize it, "Product ID" will no longer be visible.

Thanks,

Armando

Parents
  • 17590
    Verified Answer
    Offline posted

    Hello Armando,

    Thank you for posting in our community.

    Currently, the default behavior of the Resizing feature (when allowDoubleClickToResize option is set to true)is to resize the column according to the containing data.

    Having in mind the sample provided I assume that you are looking for a way to set a minimal width for the columns under which columns could not be resized. What I can suggest in this scenario is handling columnResizing event. In this event the current column width during resizing could be retrieved using desiredWidth option. If this width is less than your required value the resize method could be used to set column width to your minimum value and cancel the event. For example:

     {
                  name: "Resizing",
                  allowDoubleClickToResize: true,
                  columnResizing: function (evt, ui) {
                  var colKey = ui.columnKey;
                  if (ui.desiredWidth < 50) {
                    $("#grid").igGridResizing("resize", colKey, 100);
                     return false;
                              }
                 }

    }

    I am also attaching a sample illustrating my suggestion for your reference. Please have a look at this sample and let mw know whether it helps you achieve your requirement.

    If this is not an accurate demonstration of what you are trying to achieve please feel free to get back to me with more details.

    I hoe you find my information helpful.

    igGridResizingMinColWidth.zip
Reply Children
No Data