Datatable inline editing without editor plugin

前端 未结 2 1861
旧巷少年郎
旧巷少年郎 2020-12-24 02:32

I was using \'editor\' plugin for data table and following was the code:

Data table editor defined as:

        editor = new $.fn.dataTable.Editor( {         


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-24 03:04

    Datatables rock! And SpryMedia let us play with it for free! I'm not 100% sure I've used the Editor Plugin despite buying it but I am pleased that I've contributed to its development in some way. One of the main reasons I've not used the plugin is because I was too skint to afford it for a while so wrote my own versions and that's really not that difficult. The steps are quite simple:

    • Detect click on row (you've already done this)
    • Get the data from the row (not at all hard)
    • Populate a form with that data (probably within a modal)
    • Update the server with the new values once the form is submitted
    • Update the row once the server has been updated

    The plugin makes all that easy and allows you to figure out the backend as well. The steps above aren't all that difficult but I've not come across something that does it all for you except for the Editor Plugin. Work through the steps and you'll get there.

提交回复
热议问题