Skip to content
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

No callback function if cell use customized render() #90

Open
babylonlin opened this issue Aug 31, 2020 · 0 comments
Open

No callback function if cell use customized render() #90

babylonlin opened this issue Aug 31, 2020 · 0 comments

Comments

@babylonlin
Copy link

I am working on a project with datatable, which has one cell using customized render function. When I apply edit to this cell, the cell value can not be updated correctly.

I tried to add one callback function in case of update cell value and modified _update function as following:


 function _update(newValue) {
                var oldValue = cell.data();
                var updateCallback = settings.inputTypes.filter(item=>item.column === columnIndex)[0].updateCallback;
                if (updateCallback) {
                    // console.log('updatecallback')
                    updateCallback(cell, row, newValue);
                    cell.data(null);
                } else {
                    // console.log('no updatecallback')
                    cell.data(newValue);
                }
                settings.onUpdate(cell, row, oldValue);
            } 

as add one option to inputTypes option

{ "column": 14, "type": "list", // requires jQuery UI: http://http://jqueryui.com/download/ "options": target_remark_types, "updateCallback": function (cell, row, newValue) { row.data().remark_type_id = parseInt(newValue); row.data().remark_type = target_remark_types.filter(target_remark=>target_remark.value === newValue)[0].display } }

so far it works well for me. But not sure if any side effects which I do not notice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant