Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82801

Simple form output without data[row_x][field]=value

$
0
0

Is there a standard way to use a simple form output for single-row editing?

e.g. https://editor.datatables.net/examples/advanced/REST.html
Sample form data:

action:edit
data[row_19][first_name]:Bradley
data[row_19][last_name]:Greer
data[row_19][position]:Software Engineer
data[row_19][office]:London
data[row_19][extn]:2558
data[row_19][start_date]:2012-10-13
data[row_19][salary]:132000

I would prefer

first_name:Bradley
last_name:Greer
position:Software Engineer
office:London
extn:2558
start_date:2012-10-13
salary:132000

I can do this using ajax.data to pull the first value from the data array, e.g.

    ajax: {
      url: '/save',
      data: function(data) {
        var out = Object.values(data.data)[0]
        return out
      }
    },

But this feels a little dirty. Is there a more standard way?


Viewing all articles
Browse latest Browse all 82801

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>