inline editing for select dropdown
inline editing for select dropdown

I am implementing Datatable editor. i want to add select dropdown in table,as well as while adding new record also. i refer the example from given link but it is not working for me. only change is instead of ajax call,i am directly reading data from JavaScript variable.
Please refer the example on the given https://editor.datatables.net/examples/inline-editing/join.html
please suggest if any changes more required in given example
This question has an accepted answers - jump to answer
Answers
Can you link to your page showing the issue please? The example you linked to appears to be showing the
select
field inline for me no problem.Allan
its available locally
now i am able to populate select dropdown.
but the thing is not able to save the data inline as well as on popup(new row)
var editor; // use a global for the submit and return data rendering in the examples
I'm afraid I don't quite understand what you mean. You say inline but also popup in the same sentence. Could you show me a screen shot of the issue?
Allan
Thanks for the reply @allan
i have added create button also,so on click of that button,whatever data entered is save except select drop down.
Same in case of inline editing for select dropdown
PFA screenshots for the same
I see the issue - thanks. The problem is that since you aren't submitting the data to the server, it can't provide the left joined data for the site name.
If you notice, the data fed into the table looks like this:
But after an edit it looks like this:
Thus the error from the DataTable.
If you want to do this client-side, what I would suggest is that you don't include
sites.name
at all - instead use a renderer which will lookup the correct name to display based onusers.site
.Allan
Thank you so much @allan ,using render its working
code changes
editor.field('users.site').input().on('change', function () {
fieldName=$('option:selected', this).text();
} );
{ data: null, editField: "users.site",
render: function ( data, type, row ) {
}
please let me know,is this the right approach
I'm not sure about that to be honest. It seems like it would be wrong if you edited more than one row and then invalidated the original row.
I think you'll need a list of the value / labels on the client side so you can do something like:
where
sites
is an object with the keys set to by the site id.Allan