3

I have a grid with the plugin Slick.CheckboxSelectColumn.

Is it possible, without Jquery, to hide checkboxes in some rows? I guess it's possible using Formatter.

Here is the var with the slickgrid checkbox plugin:

var checkboxSelector = new Slick.CheckboxSelectColumn({             
         cssClass: "slick-cell-checkboxsel"
     });

Columns definition:

var columns = [
        { id: "Id", name: "Id", field: "Id", sortable: true, width: 40 },            
        { id: "Status", name: 'Status', field: "Status", sortable: true, width: 80 },
        checkboxSelector.getColumnDefinition()
     ];

Code to create grid and register plugins:

grid = new Slick.Grid("#grid", dataView, columns, options);
     grid.registerPlugin(new Slick.AutoTooltips({ enableForHeaderCells: true }));
     grid.registerPlugin(checkboxSelector)

SOLUTION

Use a custom plugin checkboxselectcolumn.js, create by @JamesSilberbauer

1 Answer 1

5

You can do so using the formatter. Before adding the column definitions to the columns list, you need to alter the formatter. This is how:

var selectorColumnDef = checkboxSelecter.getColumnDefinition();
var currentFormatter = selectorColumnDef.formatter;
selectorColumnDef.formatter = function(row, cell, value, columnDef, dataContext) {
   if (showCheckBox) {
      return currentFormatter(row, cell, value, columnDef, dataContext);
   }
   return "";
};
var columns = [
        { id: "Id", name: "Id", field: "Id", sortable: true, width: 40 },            
        { id: "Status", name: 'Status', field: "Status", sortable: true, width: 80 },
        selectorColumnDef
     ];
Sign up to request clarification or add additional context in comments.

1 Comment

A custom plugin checkboxselectcolumn.js, create by @JamesSilberbauer. It´s perfect. Thanks for your attention.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.