jQWidgets Forums

jQuery UI Widgets Forums Grid Dynamic data bind

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 10 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Dynamic data bind #55083

    mustafa
    Participant

    hello How do I add dynamic localdata ?

     var newSource= [{ "empName": "test", "age": "67", "department": { "id": "1234", "name": "Sales" }, "author": "ravi"}];
    
    // prepare the data
    window.Gridsource =
    {
        datatype: "json",
        datafields: [
            { name: 'empName' },
            { name: 'age' },
            { name: 'id', map: 'department>id' },
            { name: 'name', map: 'department>name' },
            { name: 'author' }
        ],
     
    };
    
        var dataAdapter = new $.jqx.dataAdapter(window.Gridsource);
        $("#CertificateGrid").jqxGrid(
               {
                   width: '100%',
                   source: dataAdapter,
                   pageable: true,     
                   height: '250px',
               
                   columns: [
                     { text: 'emp Name', datafield: 'empName',width: 100 },
                     { text: 'department', datafield: 'department', width: 20 },
                     { text: 'age', datafield: 'age', width: 20 },
                     { text: 'name', datafield: 'name', width: 20 },
                     { text: 'author', datafield: 'author', width: 20 } 
                   ]              
               });

    call dynamicDataBind()

    
    function dynamicDataBind()
    {
        Gridsource.localdata = newSource;    
    
        var dataAdapter = new $.jqx.dataAdapter(Gridsource);
        $("#CertificateGrid").jqxGrid({ source: dataAdapter });
        $("#CertificateGrid").jqxGrid('updatebounddata', 'cells');
    
    }

    but I see error
    0x800a1391 – JavaScript runtime error: ‘data’ is undefined

    thank you

    Dynamic data bind #55088

    Peter Stoev
    Keymaster

    Hi mustafa,

    http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/refreshdata.htm?arctic – demonstrates how to dynamically update the Grid’s data.

    Best Regards,
    Peter Stoev

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

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

You must be logged in to reply to this topic.