jQuery UI Widgets Forums DataTable Nested Data Tables with JSON only

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 6 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Nested Data Tables with JSON only #95528


    Guys, good morning!
    I have a silly question regarding Nested Data Tables.
    Imagine the following scenario, a parent table with the fields NOME, street, ZIP code and a child table with the fields id, NOME, phone number and obs.

    The page makes an AJAX call to a php file that returns a JSON vector like this:

    type: “POST”,
    data: {p0: ops, p1: opp1}, //Search Parameters
    url: “auxsetup.php”, //Php file that generates the result in json format
    datatype: “html”,
    success: function (result) { //HERE LOAD JSON RESULT
    var source = {
    dataType: “json”,
    datafields: [
    {name: ‘nome’, type: ‘string’},
    {name: ‘uf’, type: ‘string’},
    {name: ‘cidade’, type: ‘string’},
    {name: ‘cep’, type: ‘string’},
    {name: ‘endereco’, type: ‘string’},
    {name: ‘obs’, type: ‘string’},
    {name: ‘fonelist’, type: ‘string’} // ====> Here I passed the records from the other table, but I just passed the number and obs
    localdata: result
    var ds_grid = new $.jqx.dataAdapter(source);
    var fonesource = {
    dataType: “json”,
    datafields = [
    {name: ‘number’, type: ‘string’},
    {name: ‘obs’, type: ‘string’}
    localdata: result[‘fonelist’];
    root: “fonelist”,
    record: “number”,
    async: false

    It is possible to get data like this, and display Nested Data Tables?

    Another way that is much simpler, would be to make the tables separate, but it is very roomy visually.
    My idea would be to load 3 or 4 tabs and each with a table But all with JSON coming from a PHP file as above example

    Nested Data Tables with JSON only #95576


    Hello Francisco,

    I saw incorrect symbols and this break the syntax of the code. ()
    Also, it is not good to use ‘number’ as a datafield because it is key word – record: “number”.
    It is important when you create a new widget and need to create a separated DataAdapter for it. Yes, it is possible to use one and the same file for both.
    You could get result variable (the data) from the parent but need to set new DataAdapter for the nested DataTable.
    Please, take a look at this example and could you clarify this “load 3 or 4 tabs and each with”, if the previous information does not help you.

    Best Regards,
    Hristo Hristov

    jQWidgets team

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.