Quantcast
Channel: DataTables 1.10 — DataTables forums
Viewing all articles
Browse latest Browse all 2364

Inline Edit w/ Select Field and Update Image In Another Field

$
0
0

My table has two columns Name and Image. Name is inline editable, and I want to update the image corresponding with that name in the neighboring image column.

To update the image column, I'm using the following javascript:

            {
                data: 'Category._idImage',
                width: '20%',
                render: function (data, type) {
                    if (typeof data !== 'undefined') {
                        if (data !== 0  &&  data !== '0'  &&  data !== null) {
                            let file = editorCategory.file('UploadedFileMembers', data);
                            if (file) {
                                return type === 'display' ? '<img width="64" src="' + file.webPath + '" />' : file.fileName;
                            }
                        }
                    }
                    return 'No image';
                }
            },

where editorCategory is the inline editor used to change the name.

I'm getting an exception thrown in dataTables.editor.js in the _api_file method (line 132 for version 1.9 of the Editor). The table in that method has information on the prior image, but not the new image associated with the new category selected from the Name column.

If I refresh the page after inline editing the Name to a different category, the correct image is retrieved and drawn.

How can I trigger things so that the table variable in the dataTables.editor.js reloads the corresponding data from my UploadedFileMembers table on an inline edit change to the Name field? Couldn't find a similar example.


Viewing all articles
Browse latest Browse all 2364

Trending Articles