Ajax Json Local | ServerSide (update)

Ajax Json Local | ServerSide (update)

federicohafedericoha Posts: 3Questions: 2Answers: 0

This is not exactly a technical question, but related one. I'm struggling to understand how to handle this scenario:

html > via jquery ajax > webservice > db (jquery datatables c# ws, sql server)

In html, handle locally json to show into datatables (2k rows, so not used serverside), in somehow with Context.Response.Write(json).. Having a form to do crud stuff on data, the question are:

  1. CRUD will be impacted into DB with other webservices
    a. DB will be different than the json locally into html when data has been updated
  2. how to show the new data into datatables with the row impacted?
    a. should update the json locally? how to do that and how to refresh datatable?
    b. should request again to the webservice all data? how do that without repeating all the request?
    c. other alternative?

was checked several pages and all the samples here, like ajax.reload, trying to use serverside (when reload works but having issues with paging) but no one with the result expected, probably for some lack of knowledge to understand clearly how to do this.

Thanks in advance.

Answers

  • federicohafedericoha Posts: 3Questions: 2Answers: 0

    auto reply

    well, for some reason started working as i expected

    still using local json, i was able to use a button to execute the oTable.ajax.reload(null, false);

    one of the change i made was add the "data" into the json string instead using dataSrc: "" and the statement

    use this: {"data":[{"Id":276935...

    instead of: [{"Id":276935...

    and start working fine the "refresh"... from the beginning was confuse to me since all the samples have the data...aaData or something into each json, but was not the case from what i return from my side (without it)... but as i said, start working

    Thanks.

  • allanallan Posts: 63,813Questions: 1Answers: 10,516 Site admin

    Interesting - it should have worked with dataSrc:'' and [{.... If you have a test case showing that issue I can take a look into it, but its good to hear you've got it working now.

    Allan

This discussion has been closed.