New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problem with checkbox column #292
Comments
Additional details below. I've found that everytime I add new column, checkbox column is also added. Is there any better way? options // Methods
|
I have this issue as well. Seems to be when columnDefs config is observable. The buildColums method will add the checkbox column, even if it has already been added (which is likely since it is subscribed to the columnDefs observable): //FILE: ..\src\classes\grid.js
//FILE: ..\src\bindingHandlers\ko-grid.js
|
This is a really old issue, but I had the same problem. There is no check to see if the select column is already added to the front, every time buildColumns is called. So I fixed my version by changing this if in self.buildColumns: to the following: This fixes the symptom. |
If you don't like changing the 3rd party libraries' source code, here is an alternative way to fix the issue by using custom binding: ko.bindingHandlers["koGridFixed"] = {
init: function (element, valueAccessor, allBindingsAccessor, data, context) {
var gridOptions = ko.utils.unwrapObservable(valueAccessor());
if (gridOptions && gridOptions.columnDefs) {
var columnDefsArr = ko.utils.unwrapObservable(gridOptions.columnDefs);
if (columnDefsArr && columnDefsArr.length > 0 && columnDefsArr[0].field === '\u2714')
columnDefsArr.splice(0, 1);
}
return ko.bindingHandlers["koGrid"].init(element, valueAccessor, allBindingsAccessor, data, context);
}
}; So, just replace all koGrid binding in views with koGridFixed. A bit more details in my blog - koGrid: Bug – Checkboxes column duplication |
Checkbox column is duplicated everytime it is loaded in second attempt, other grid on the same context also adding its checkbox column. Here's the scenario, all grids are inside jquery ui tab. Each tab panel is generated from template (not remote tab). The 'grid columns' (not sure if this is the cause) inside the first tab was populated dynamically. When an action is clicked inside the grid in the 1st tab, 2nd tab will be generated with its grid. On first load, it is fine, but after i closed the 2nd tab and generate it again, all checkbox column on each grid are incremented. Please help
The text was updated successfully, but these errors were encountered: