DataTable edit inside an Editor modal possible?
DataTable edit inside an Editor modal possible?

Is it possible to include a datatable inside on editor modal? And also have that datatable allow inline editing? My use case for this is I have a table of records, and each record has a field which satisfies a one to many relationship. This field can then be represented by another table which I would like to be able to edit, but do so within the modal editor which is being used for the remainder of the fields of the current row/record. I hope that makes sense.
This question has accepted answers - jump to:
Answers
Yes, absolutely a DataTable can be used in a modal - however, there isn't a build in field type for that at the moment. I do have a prototype plug-in I can send you if you would like (is the e-mail address you used to register okay?). It hasn't been released yet as there are a few improvements I'd like to make to DataTables core to make the plug-in easier to use, but it does work well.
Allan
I would love to take a look at what you have. This email I registered with is great. It would be incredible if I could have an editable table inside an editor modal instance. Thanks Allan
That is won't do (at least that isn't what it is intended for at the moment although it could possibly be hacked to do it). It is really designed as a row selector. Do you still want to see that?
Allan
I guess I would have to see it to understand more fully what you mean by "row selector". So, yes please, I would like to see what it can do and if it's even what we want or need. Thanks.
Basically the current goal is to display a DataTable in place of a
select
list. That presents a number of nice display options for the user to be able to select the data from.I've just sent it over.
Allan
Thanks, but what I am really working toward is being able to open a modal dataTable using the data from a specific column.
This column data will be an array of objects, and is therefore why I am hoping I can display this column data in a modal as a dataTable, and yet still allow inline edit of said modal/DataTable.
Is this at all possible, with the current library?
I don't see why it wouldn't be possible, but it isn't something that I've tried, and therefore there isn't an example of it.
The first step would probably be to display the modal without using Editor (it sounds like you just want a modal with a DataTable in it). At that point the DataTable in the modal is just a regular DataTable, so you can do whatever you need with it, including inline Editing.
Allan
Thanks Allan,
I am wondering how to supply my column data for the new DataTable. Is there some way I can plug that column data into the
data
option for the new DataTable?for example, let's say I have a dataTable:
And then for the new dataTable modal, plug in the column data into the data option?:
So I am not sure if that is what I need or if there is more, like having to draw() the table once the modal is revealed. Either way, I am having a hard time getting my data to show in the modal.
You would actually just use
data()
orrows().data()
for the above. Thecolumn().data()
option will only give you a single column - it looks like you want both.You do need to be careful doing that though since DataTables will give you the original data object. So if you change it in the second, it would be changed in the first, but DataTables wouldn't know that. You probably want to take a copy of the data, which you could do with
$.extend()
.Allan
I, also, would love to see the plug-in you have in the works. It may be over my head, but it may be just what I need. Is this the appropriate place to ask for this?
Sent you a PM :-)
Thank you!
Can I see the plug-in too? Thanks!
I'd glad as well, also posted a request on your activity wall (or whatever it's called)
Can you help me, I'am struggling in finding a datatable with edit row in a modal, Do you have any idea sir?
All of these examples provide row editing in a modal.
Allan
Allan,
I know I'm a little late to the discussion, but if that plugin is still available could you send it? I have a similar situation as the above, namely a "Request" in a pre-submit state that is made up of a bunch of suggested fields that can be overridden in a Row/Col format before submitting. Perfect opportunity to use a datatable on the modal with inline editing. Thanks!