Update w2grid.js to fix editable function #2648
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Short description
editable: function(record, extra) doesn't work.
What is current behavior
editable only works with object, not function.
in w2grid.js:
8476 edit = (Object.keys(col.editable ?? {}).length > 0 ? col.editable : null)
8477 if (typeof edit === 'function') {
8478 let value = this.getCellValue(ind, col_ind, false)
8479 // same arguments as col.render()
8480 edit = edit.call(this, rec, { self: this, value, index: ind, colIndex: col_ind })
8481 }
solution: 8477 and 8480, change edit to col.editable, it will work for editable when it is function.
also, many thanks to vitmalina for this great product.
8477 if (typeof col.editable === 'function') {
8478 let value = this.getCellValue(ind, col_ind, false)
8479 // same arguments as col.render()
8480 edit = col.editable.call(this, rec, { self: this, value, index: ind, colIndex: col_ind })
8481 }