[Data Grid Reactive] Disabling checkbox (wijmo Selector) on condition not working properly
Forge component by OutSystems R&D
Application Type
Reactive

Hello Support,
We have created the bulk select checkbox as I mentioned in this post
[Data Grid Reactive] Select rows with checkbox and bulk select

Now, there is a requirement to disable the checkbox based on some conditions.
We are being able to disable the checkbox with certain conditions. On the onInitialize events:

var grid = GridAPI.GridManager.GetGridById($parameters.GridWidgetId).provider;
grid.columnHeaders.rows.defaultSize = grid.cells.rows.defaultSize;
var selector = new wijmo.grid.selector.Selector(grid);
grid.selectionMode = wijmo.grid.SelectionMode.MultiRange;

GridAPI.GridManager.GetGridById($parameters.GridWidgetId).provider.formatItem.addHandler(function(grid, e) {
     if (e.col === 0) {
       if(grid.rowHeaders.getCellElement(e.row, 0)!== null && grid.rowHeaders.getCellElement(e.row, 0).querySelector("input").classList.contains("wj-column-selector")){
            // get the last column's value 
            var value = grid.getCellData(e.row, grid.columns.length - 1);
            
            // get the checkbox element
            var checkbox = grid.rowHeaders.getCellElement(e.row, 0).querySelector("input");
            
            // if the last columns value is not equal to 1, then disable the checkbox
            if( value === 1 ){
                checkbox.disabled = false;
            } else {
                checkbox.disabled = true;
                checkbox.checked = false;
            }
        }
    }
});


But the problem is:
When we scroll vertically, the disabled checkbox is being enabled.

May be some update is going on. What am I doing wrong?

Could you please help me with this issue.


Is there better way to display the bulk selection checkbox and disable certain selection checkbox?
Please help.

Thank you in advance.

mvp_badge
MVP

Hi @Alam,

Thank you for bring this into discussion.

This feature doesn't exist in the supported version, an although it's great to see you extending the component (event better if through a Pull Request), it also means that it falls outside of the supported scenario.

That being said, if you can share a link (for a live app with the problem), or an OML replicating the problem, that will help me or any other user of the community to see the problem and to try to help you.

Cheers,
RG

Hello @Ruben Goncalves
Thank you.
I will share the live link and oml.
Live demo
Hope it will help the community understand the issue.

Regards,
Alam

DataGridSampleReactivev12.oml

Hello @Alam ,

We have been exploring this and it seems that format items event is not being triggered for the header column (the column containing the checkbox) every time you scroll.

In order to work there can't be any scroll, since wijmo flexgrid, only renders the html that is visible.

We have been checking the Selector documentation and can't find anything that helps.

We would recommend for you to ask in the Grapecity forum how is possible to achieve your requirements using pure JS. If possible we can help to implement that solution in Data Grid.

Thanks,

Bruno Martinho

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.