dataSrc for Editor?
dataSrc for Editor?
Hi,
I'm using ajax.dataSrc
in DataTables to manipulate my data to restructure a complex json to fit the needs of selectize
. This works.
But since I'm using an inline Editor I need the same function for DataTables Editor, after it POSTs the users changes to my server.
Any hints on that?
Thanks,
Tim
This question has accepted answers - jump to:
This discussion has been closed.
Answers
This already has answers in the Forum. For example:
https://datatables.net/forums/discussion/24809/feature-request-add-ajax-datasrc-to-editor
thanks for the link, maybe I'm failing to see something obvious, but how is this supposed to work?
The documentation Example shows how to define the custom ajax function, but how do I actually use it?
I mean, somewhere I have to call this function and fill in the parameters, right? Where and how?
This is my code (example with added dataFilter)
Sorry Tim, I'm not sure enough on the detailed implementation. No doubt Allan will step in on Monday.
The
ajax.dataStc
option is primarily designed to be able to tell DataTables where in a JSON object the data for the table is located. Editor doesn't need such an option since it reads the data from the rows in the DataTable.What I'm to quite clear on here is what you want to achieve with respect to the interface between Editor and Selectize. Do you have data in each Ajax return that Editor receives that you want to be able to modify and then use in Selectize? If so, the
postSubmit
event provides the option to be able to modify the JSON object returned from the server before Editor does any processing on it.Allan
Hi Allan,
I'm using
ajax.dataSrc
to reduce complexity of my data source (the articles part):my function called by
ajax.dataSrc
transforms this into:which is then used by
selectize
to work correctly.If there is a manual way to feed data into selectize please tell me, this may work with an event then.
You can use the
update()
method of the selectize field type.Allan
Thanks allan!
For reference, my solution looks like this:
this allows me to simplify my datastructure at the client. Not included: transforming it back to the original datastructure (b.c. I was able to modify the backend :P )