Skip to content

'Indeterminate' checkbox state #123

@Jollus174

Description

@Jollus174

I have a demo of the 'Indeterminate' checkbox in the top-left being buggy in this demo: https://codepen.io/joel-sweetman/pen/GRZMqjY

  • The first example is a dataTable initalised through an existing table (this is where the buggy indeterminate checkbox state occurs).
  • The second is through JSON data passed into it (the indeterminate state here works as expected).

I'm about to do a fork and investigate further, but I believe the issue is occurring here in the code:

	$.each(cellsData, function(index, cellData){
		// If checkbox is not disabled
               if(self.isCellSelectable(colIdx, cellData)){
                  if(
                     Object.prototype.hasOwnProperty.call(self.s.data, colIdx)
                     && Object.prototype.hasOwnProperty.call(self.s.data[colIdx], cellData)
                     ) {
                     countChecked++;
                  }

               // Otherwise, if checkbox is disabled
               } else {
                  countDisabled++;
               }
            });

It looks like countChecked is not counting correctly in the first demo, which will cause the indeterminate checkbox state for selectAll to not be toggled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions