Help with Slickgrid

30 views
Skip to first unread message

Dinesh K

unread,
Mar 1, 2016, 12:40:17 PM3/1/16
to SlickGrid
Hi Developers and Intelligent Beings,

I am a new bee working with slickgrid.

I have grid with column formatter and I i am using autoresize plugin that is made for the grid.

I am modifying the coulumnformatter every time gird column is resized.

when i am using the autoreize the resize value that I am changing ( say I am changing a particular column when resized less that its content to show ***'s as the value.) is not reverted to show its actual value when i call the autoreize method.


sGridN.getInheritedCellFormatter = function (parentFormatter) {
            return function (row, cell, value, columnDef, dataContext) {
                var formattedValue = parentFormatter.apply(this, arguments);
                var columnId = columnDef.id;
                var intVal = parseInt(value);
                if (isNaN(intVal) || !BaseNillionizer.isNillionField(columnDef)) {
                    //when value is not a number
                    // or the column is not in need for nillion feature, just return default formatted value
                    return formattedValue;
                }
                return sGridN.valueToShow(value, formattedValue, columnId); // this function basically tests and see if the content width is smaller than the length of content it starts showing stars(***).
            };
        };

this is the plugin code that is interating..

function reSizeColumn(e) {
            var headerEl = $(e.currentTarget).closest('.slick-header-column');
            var columnDef = headerEl.data('column') || colDef;

            if (!columnDef || !columnDef.resizable) {
                return;
            }

            e.preventDefault();
            e.stopPropagation();

            var headerWidth = getElementWidth(headerEl[0]);
            var colIndex = grid.getColumnIndex(columnDef.id);
            var allColumns = grid.getColumns();
            var column = allColumns[colIndex];

            var autoSizeWidth = Math.max(headerWidth, getMaxColumnTextWidth(columnDef, colIndex)) + 1;

            if (autoSizeWidth !== column.width) {
                column.width = autoSizeWidth;
                grid.setColumns(allColumns);
                grid.onColumnsResized.notify();
                grid.onColumnsResized.subscribe();
            }
        }


can anyone suggest a pointer so I can look into?

I have been struggling with this for couple of days any help is appreciated.


Thanks a Bunch.

Dinesh



Reply all
Reply to author
Forward
0 new messages