Data Table Editor Integration With Django

Data Table Editor Integration With Django

partha_arimapartha_arima Posts: 2Questions: 2Answers: 0

I am not able to get the updated values in my django views while performing the edit operation in the data table.

I console the data inside the 'preSubmit' method of data table editor and its working fine as I expected.

editor.on( 'preSubmit', function ( e, data, action ) {
        console.log(data)

    }
 )

Here is the output

{action: "edit", data: {19054002: {description: "Orion ChocoPie 560gm"}}, table_name: "rp_p_m"}

But the problem is while fetching all the keys in django view I am not getting all the keys as I expect which are

['action', 'data', 'table_name'].

Instead, I am getting the output like this

['action', 'data[19054002][description]', 'table_name']

All the nested keys get combined with the key 'data'.

Answers

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    I'm afraid I can't help with the Django aspect - you'd need to ask in a Django forum or StackOverflow for how to read nested data like that.

    The other alternative would be to submit JSON data rather than HTTP variables, which you can do with ajax.data (last example on that page).

    Allan

This discussion has been closed.