jQWidgets Forums

jQuery UI Widgets Forums Grid jgrid call again not display

This topic contains 2 replies, has 2 voices, and was last updated by  Dimitar 11 years, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • jgrid call again not display #30272

    TrungTran
    Member

    Hi All,

    – I study jqwidgets. I using jgrid. But not problem show data.

    – Step I call function load jgrid it work. After I call function other load data to $(‘#jqxgrid’).html(‘dfd’).

    – I call function load jgrid again. then it not work.

    – Please help.

    See code :

    -$(document).ready(function () {
    data();
    });
    function data()
    {
    var theme = getDemoTheme();
    var source =
    {
    datatype: “json”,
    datafields: [
    { name: ‘CompanyName’},
    { name: ‘ContactName’},
    { name: ‘ContactTitle’},
    { name: ‘Address’},
    { name: ‘City’}
    ],
    url: ‘grid_data.php’,
    cache: true,
    async: true
    };

    var dataAdapter = new $.jqx.dataAdapter(source);

    $(“#jqxgrid”).jqxGrid(
    {
    source: source,
    theme: theme,
    columns: [
    { text: ‘Company Name’, datafield: ‘CompanyName’, width: 250},
    { text: ‘ContactName’, datafield: ‘ContactName’, width: 150 },
    { text: ‘Contact Title’, datafield: ‘ContactTitle’, width: 180 },
    { text: ‘Address’, datafield: ‘Address’, width: 200 },
    { text: ‘City’, datafield: ‘City’, width: 120 }
    ]
    });

    }
    function datahtml()
    {
    $(‘#jqxgrid’).html(‘dfd’);
    }

    jgrid call again not display #30317

    TrungTran
    Member

    TrungTran
    Hi All,

    – I study jqwidgets. I using jgrid. But not problem show data.

    – Step I call function load jgrid it work. After I call function other load data to $(‘#jqxgrid’).html(‘hello’).

    – And after I call function load jgrid again. then it not work.

    – Please help.

    See code :

    -$(document).ready(function () {
    data();
    });
    function data()
    {
    var theme = getDemoTheme();
    var source =
    {
    datatype: “json”,
    datafields: [
    { name: ‘CompanyName’},
    { name: ‘ContactName’},
    { name: ‘ContactTitle’},
    { name: ‘Address’},
    { name: ‘City’}
    ],
    url: ‘grid_data.php’,
    cache: true,
    async: true
    };

    var dataAdapter = new $.jqx.dataAdapter(source);

    $(“#jqxgrid”).jqxGrid(
    {
    source: source,
    theme: theme,
    columns: [
    { text: ‘Company Name’, datafield: ‘CompanyName’, width: 250},
    { text: ‘ContactName’, datafield: ‘ContactName’, width: 150 },
    { text: ‘Contact Title’, datafield: ‘ContactTitle’, width: 180 },
    { text: ‘Address’, datafield: ‘Address’, width: 200 },
    { text: ‘City’, datafield: ‘City’, width: 120 }
    ]
    });

    }
    function datahtml()
    {
    $(‘#jqxgrid’).html(‘hello’);
    }

    jgrid call again not display #30323

    Dimitar
    Participant

    Hello TrungTran,

    You should make some modifications to your datahtml function:

    function datahtml() {
    $('#jqxgrid').jqxGrid('destroy');
    $("body").append("<div id='jqxgrid'></div>");
    $('#jqxgrid').html('hello');
    }

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.