In fact I want use one reduced form for the 'create' part which show only required fields and the complete form (with all fields) for the 'Edit' and 'delete' parts. Does Editor support this kind of thing?
Absolutely - there are two ways of doing this. Firstly to use two different Editor instances, each configured differently, then in TableTools you would do something like:
Thanks Allan! I went for the first solution but got a warning message "DataTables warning (table id = 'incident'): Requested unknown parameter 'commentaires' from the data source for row 105"
before adding a new row. All, the returned json include, seems to be correct nevertheless! the field 'commentaires' is not required and is not in the 'create' form.
I'd probably need to see the page to be able to say for sure what is happening, but it sounds like you might want to use sDefaultContent to assign a default for the cell?
Allan,
In my incidents management table, when In the Editor, I'm checking for duplicate records in creation stage, If the record represent an incident already closed, I want display the record in the update (edit) form and ask the user if he wants re-open and update it.
To use the edit form to display the data, you need to use the API. Is this an edit form which is already open? If so, then use the `set` method: http://editor.datatables.net/api/#set . If the edit form is not already open, use the `edit` method: http://editor.datatables.net/api/#edit , passing in the row you want to edit.
Allan,
In fact my problem is a little bit complicated. To test a duplicated record in the creation phase, I make a request to the database. If a record with the same incident number exists and is already closed, I want show this record in the edit form and ask the user if he want to re-open the incident.
So I think I have to insert the found record in the table and show it in the edit form. What api should I use?
Replies
[code]
{ "sExtends": "editor_create", "editor": editor_create },
{ "sExtends": "editor_edit", "editor": editor },
{ "sExtends": "editor_remove", "editor": editor }
[/code]
The other option is to listen for the onCreateInit and onEditInit events and show / hide the required fields.
Allan
before adding a new row. All, the returned json include, seems to be correct nevertheless! the field 'commentaires' is not required and is not in the 'create' form.
Allan
In my incidents management table, when In the Editor, I'm checking for duplicate records in creation stage, If the record represent an incident already closed, I want display the record in the update (edit) form and ask the user if he wants re-open and update it.
How can use the edit form to display the data?
Allan
In fact my problem is a little bit complicated. To test a duplicated record in the creation phase, I make a request to the database. If a record with the same incident number exists and is already closed, I want show this record in the edit form and ask the user if he want to re-open the incident.
So I think I have to insert the found record in the table and show it in the edit form. What api should I use?
1. Use fnAddData to add the new data to the table
2. Use the Editor `edit` method to edit the new row ( http://editor.datatables.net/api/#edit ).
Allan