jQuery editTable
jQuery editTable is a very small jQuery Plugin (~1Kb gzipped) that fill the gap left by the missing of a default input field for data tables. jQuery editTable can be used both in ajax and/or HTTP POST contest and let you preset the title and number of columns or just let complete freedom to the user. You can even append custom behaviors to single column cells (ex. jQuery UI Datepicker). The only limit is your imagination! :)
To use it you just have to include jQuery and a copy of the plugin in your head or footer:
Now you can trigger editTable on any textarea or block element (ex. div, article, section ...). In case you trigger it on a textarea, its content will be used as JSON source for the table. If the textarea is inside a form, on submit, its content will be updated with the new JSON data. Otherwise, if you trigger it on a block element the table will be appended to the element itself (ajax).
var mytable = ;
There are of course many methods which can be used on the created table. Let's see...
mytable; // Fill the table with js datamytable; // Fill the table with JSON datamytable; // Get a js array of the table datamytable; // Get JSON from the table datamytable; // Reset the table to the initial set of datamytable // Check if the table pass validation set with validate_field
To define a custom field type object:
'checkbox' : html: '<input type="checkbox">' // Input type html // How to get the value from the custom input { return ; } // How to set the value of the custom input { if value return ; return ; }
That's it, now give a look to the examples to understand how it works.
Credits and contacts
ReStable has been made by me. You can contact me at micc83@gmail.com or twitter for any issue or feauture request.