Edit data using js_array

Edit data using js_array

ACosta123ACosta123 Posts: 9Questions: 3Answers: 0

I have been using this approach to display my data and all is ok. I now would like to be able to edit my data and save it back to BD. How would I get to do this using this aproach?
How do I get back my edited dataSet and save it to my variable acallGridImport?

var dataSet = jQuery.parseJSON($("#acallGridImport").getValue());

var editor;

$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
data: dataSet,
table: "#example",
fields: [
{
label: "Incidente:",
name: "IN"
}, {
label: "Modelo:",
name: "MODEL"

....etc

Thanks for your help.

Costa

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    data: dataSet, there is no such option in Editor - it will read the table from the data directly - see this example.

    Can you give me a link to what you currently have?

    Allan

  • ACosta123ACosta123 Posts: 9Questions: 3Answers: 0

    Hi Allan,

    After running a previous php script to select data and crate an array called "acallGridImport".
    I then present that data to Datatables using this command, creating the dataSet variable.

    var dataSet = jQuery.parseJSON($("#acallGridImport").getValue());

    I would rather use ajax, but I cant run .php files from my public web page folders. would there be a workaround for this?

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Editor doesn't "get" the data either via a data parameter or via Ajax. It relies upon DataTables to do that data fetch for it.

    Can you show me your full code please?

    If you can't use Ajax, how are you planning on saving the data to the database?

    Allan

This discussion has been closed.