jQWidgets Forums

Forum Replies Created

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • in reply to: Binding JSON data to jqxGrid Binding JSON data to jqxGrid #48236

    oneeyeman
    Participant

    Hi, Peter,
    I made it work. Thank you for the help.
    I fixed some problems on the Django side and it was enough to send the data appropriately.

    Now everything works.

    A huge thank you.

    in reply to: Binding JSON data to jqxGrid Binding JSON data to jqxGrid #48150

    oneeyeman
    Participant

    OK, I changed double quotes to single quotes.
    No luck. I still see the horizontal grey line on top and nothing else.

    Thank you.

    in reply to: Binding JSON data to jqxGrid Binding JSON data to jqxGrid #48145

    oneeyeman
    Participant

    Peter,
    First of all, thank you for the help.
    Now, what I have here is Windows XP SP3 with IE8 and the following code running from the jqxGrid demo folder does not produce a grid. All I see is the horizontal grey line at the top of the browser.
    Is this package compatible with this browser? Please confirm.

    Thank you.

    The code:

    
    <!DOCTYPE html>
    <html>
    <head>
    <title>Test</title>
     
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdatatable.js"></script>
    <script type="text/javascript" src="../../jqxgrid.columnsresize.js"></script>
    <script type="text/javascript"> 
        $(document).ready(function(){
            var data = "[{"pk": 1, "model": "displayusbdata.usb", "fields": {"vid": "#1058", "pid": "#0748", "evidence": 5, "vol_serial5": "-", "vol_serial4": "-", "vol_serial1": "                                        ", "vol_serial3": "-", "vol_serial2": "-", "port": 3, "last_modify_regtime3": null, "vol_name5": "-", "disk_device": null, "revision": "#1019", "product": "ses_device", "vendor": "wd", "last_modify_regtime5": null, "hub": 4, "last_modify_regtimes1": null, "last_modify_regtimes2": null, "volume": "", "user": "", "vid_pid": null, "vol_name1": "", "vol_name2": "-", "vol_name3": "-", "vol_name4": "-", "usb_type": "other", "volume_device": null, "last_modify_regtime4": null, "device_name": "wd ses_device", "instance_id": "57583431453732444a323437&1", "install": null, "volume_name": "", "volume_guid": "", "user_datetime": null}}]";	
            var source =
            {
                localdata: data,
                datatype: "json",
                datafields:
                [
                    { name: 'device_name', map: 'fields>device_name', type: 'string' },
                    { name: 'vid_pid', map: 'fields>vid_pid', type: 'date' },
                    { name: 'install', map: 'fields>install', type: 'date' },
                    { name: 'disk_device', map: 'fields>disk_device', type: 'date' },
                    { name: 'volume_device', map: 'fields>volume_device', type: 'date' },
                    { name: 'usb_type', map: 'fields>usb_type', type: 'string' },
                    { name: 'vid', map: 'fields>vid', type: 'string' },
                    { name: 'pid', map: 'fields>pid', type: 'string' },
                    { name: 'hub', map: 'fields>hub', type: 'number' }
                ],
                id: 'pk'
            };
            var dataAdapter = new $.jqx.dataAdapter(source);
            //initialize jqxGrid
            $("#grid").jqxGrid(
            {
                source: dataAdapter,
                showstatusbar: true,
                editable: false,
                columns:
                [
                    { text: 'Device Name', columntype: 'textbox', datafield: 'device_name', width: 100 },
                    { text: 'VID/PID', columntype: 'textbox', datafield: 'vid_pid', width: 50 },
                    { text: 'Install', columntype: 'textbox', datafield: 'install', width: 50 },
                    { text: 'Disk Device', columntype: 'textbox', datafield: 'disk_device', width: 50 },
                    { text: 'Volume Device', columntype: 'textbox', datafield: 'volume_device', width: 50 },
                    { text: 'Type', columntype: 'textbox', datafield: 'usb_type', width: 100 },
                    { text: 'VID', columntype: 'textbox', datafield: 'vid', width: 100 },
                    { text: 'PID', columntype: 'textbox', datafield: 'pid', width: 100 },
                    { text: 'Hub', datafield: 'hub', cellsalign: 'right', cellsformat: 'n2' }
                ]
            });
        });
    </script>
    </head>
    <body>
    <div id='jqxWidget'>
        <div id="grid"></div>
    </div>
    </body>
    </html>
    
    in reply to: Binding JSON data to jqxGrid Binding JSON data to jqxGrid #48048

    oneeyeman
    Participant

    Hi, Peter,
    I got rid of the ugly "&quot;" text.
    So now my page code looks like this:

    
    <!DOCTYPE html>
    <html>
    <head>
    <title>Test</title>
     
    <link rel="stylesheet" href="/static/jqwidgets-ver3.1.0/jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="/static/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.sort.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.filter.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.aggregates.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.selection.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.pager.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.grouping.js"></script>
    <script type="text/javascript"> 
        var data = "[{"pk": 1, "model": "displayusbdata.usb", "fields": {"vid": "#1058", "pid": "#0748", "evidence": 5, "vol_serial5": "-", "vol_serial4": "-", "vol_serial1": "                                        ", "vol_serial3": "-", "vol_serial2": "-", "port": 3, "last_modify_regtime3": null, "vol_name5": "-", "disk_device": null, "revision": "#1019", "product": "ses_device", "vendor": "wd", "last_modify_regtime5": null, "hub": 4, "last_modify_regtimes1": null, "last_modify_regtimes2": null, "volume": "", "user": "", "vid_pid": null, "vol_name1": "", "vol_name2": "-", "vol_name3": "-", "vol_name4": "-", "usb_type": "other", "volume_device": null, "last_modify_regtime4": null, "device_name": "wd ses_device", "instance_id": "57583431453732444a323437&1", "install": null, "volume_name": "", "volume_guid": "", "user_datetime": null}}, {"pk": 2, "model": "displayusbdata.usb", "fields": {"vid": "#1058", "pid": "#0748", "evidence": 5, "vol_serial5": "-", "vol_serial4": "-", "vol_serial1": "                                        ", "vol_serial3": "-", "vol_serial2": "-", "port": 3, "last_modify_regtime3": null, "vol_name5": "-", "disk_device": null, "revision": "#1019", "product": "ses_device", "vendor": "wd", "last_modify_regtime5": null, "hub": 4, "last_modify_regtimes1": null, "last_modify_regtimes2": null, "volume": "", "user": "", "vid_pid": null, "vol_name1": "", "vol_name2": "-", "vol_name3": "-", "vol_name4": "-", "usb_type": "other", "volume_device": null, "last_modify_regtime4": null, "device_name": "wd ses_device", "instance_id": "575834314537325538343836&1", "install": null, "volume_name": "", "volume_guid": "", "user_datetime": null}},
    # A lot more records
    ]";
        $(document).ready(function(){
            var source =
            {
                localdata: data,
                datatype: "json",
                datafields:
                [
                    { name: 'device_name', type: 'string' },
                    { name: 'vid_pid', type: 'date' },
                    { name: 'install', type: 'date' },
                    { name: 'disk_device', type: 'date' },
                    { name: 'volume_device', type: 'date' },
                    { name: 'usb_type', type: 'string' },
                    { name: 'vid', type: 'string' },
                    { name: 'pid', type: 'string' },
                    { name: 'hub', type: 'number' }
                ],
                id: 'pk',
                root: 'fields'
            };
            var dataAdapter = new $.jqx.dataAdapter(source)
            //initialize jqxGrid
            $("#grid").jqxGrid(
            {
                source: dataAdapter,
                showstatusbar: true,
                editable: false,
                columns:
                [
                    { text: 'Device Name', columntype: 'textbox', datafield: 'device_name', width: 100 },
                    { text: 'VID/PID', columntype: 'textbox', datafield: 'vid_pid', width: 50 },
                    { text: 'Install', columntype: 'textbox', datafield: 'install', width: 50 },
                    { text: 'Disk Device', columntype: 'textbox', datafield: 'disk_device', width: 50 },
                    { text: 'Volume Device', columntype: 'textbox', datafield: 'volume_device', width: 50 },
                    { text: 'Type', columntype: 'textbox', datafield: 'usb_type', width: 100 },
                    { text: 'VID', columntype: 'textbox', datafield: 'vid', width: 100 },
                    { text: 'PID', columntype: 'textbox', datafield: 'pid', width: 100 },
                    { text: 'Hub', datafield: 'hub', cellsalign: 'right', cellsformat: 'n2' }
                ]        
            });
        });
    </script>
    </head>
    <body>
    <div id='jqxWidget'>
        <div id="grid"></div>
    </div>
    </body>
    </html>
    

    It is much easier to read and comprehend.
    Do you see any problems with the code?

    Thank you.

    in reply to: Binding JSON data to jqxGrid Binding JSON data to jqxGrid #47975

    oneeyeman
    Participant

    Hi, Peter,
    I cleaned my IE cache, restarted the server and tried to go to the page again.
    I now get the 200 responce on the server log, but the page is still empty.

    What else can I try?
    Is my script OK?

    Thank you.

    in reply to: Binding JSON data to jqxGrid Binding JSON data to jqxGrid #47891

    oneeyeman
    Participant

    Peter,
    I removed that line but still getting “Error on page”, the page is still empty and server terminal shows following:

    
    [15/Jan/2014 02:32:19] "GET /static/jqwidgets-ver3.1.0/jqwidgets/styles/jqx.base
    .css HTTP/1.1" 304 0
    [15/Jan/2014 02:32:19] "GET /static/jquery-1.10.2.js HTTP/1.1" 304 0
    [15/Jan/2014 02:32:19] "GET /static/jqwidgets-ver3.1.0/jqwidgets/jqxcore.js HTTP/1.1" 304 0
    [15/Jan/2014 02:32:19] "GET /static/jqwidgets-ver3.1.0/jqwidgets/jqxdata.js HTTP/1.1" 304 0
    [15/Jan/2014 02:32:19] "GET /static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.js HTTP/1.1" 304 0
    [15/Jan/2014 02:32:19] "GET /static/jqwidgets-ver3.1.0/jqwidgets/jqxscrollbar.js HTTP/1.1" 304 0
    [15/Jan/2014 02:32:19] "GET /static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.sort.js HTTP/1.1" 304 0
    [15/Jan/2014 02:32:19] "GET /static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.filter.js HTTP/1.1" 304 0
    [15/Jan/2014 02:32:19] "GET /static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.pager.js HTTP/1.1" 304 0
    [15/Jan/2014 02:32:19] "GET /static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.selection.js HTTP/1.1" 304 0
    [15/Jan/2014 02:32:19] "GET /static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.aggregates.js HTTP/1.1" 304 0
    [15/Jan/2014 02:32:19] "GET /static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.grouping.js HTTP/1.1" 304 0
    

    What is this “304” error?
    I restarted my server and receive those errors….
    Maybe that’s why I’m getting “Error on page”?

    Thank you.

    [EDIT]
    I didn’t touch anything on the server or the client side. Just remove the offending line.
    But sometimes I did get that same error even before.
    [/EDIT]

    in reply to: Binding JSON data to jqxGrid Binding JSON data to jqxGrid #47888

    oneeyeman
    Participant

    Peter,
    OK, here is the complete html code for the page:

    
    <!DOCTYPE html>
    <html>
    <head>
    <title>Test</title>
    {% load staticfiles %}
    <link rel="stylesheet" href="{% static "jqwidgets-ver3.1.0/jqwidgets/styles/jqx.base.css" %}" type="text/css" />
    <script type="text/javascript" src="{% static "jquery-1.10.2.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxcore.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxdata.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxscrollbar.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxgrid.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxgrid.sort.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxgrid.filter.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxgrid.aggregates.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxgrid.selection.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxgrid.pager.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxgrid.grouping.js" %}"></script>
    <script type="text/javascript">
        var data = "{{usb_data}}";
        $(document).ready(function(){
            var source =
            {
                localdata: data,
                datatype: "json",
                datafields:
                [
                    { name: '&quot;device_name&quot;', type: 'string' },
                    { name: '&quot;vid_pid&quot;', type: 'date' },
                    { name: '&quot;install&quot;', type: 'date' },
                    { name: '&quot;disk_device&quot;', type: 'date' },
                    { name: '&quot;volume_device&quot;', type: 'date' },
                    { name: '&quot;usb_type&quot;', type: 'string' },
                    { name: '&quot;vid&quot;', type: 'string' },
                    { name: '&quot;pid&quot;', type: 'string' },
                    { name: '&quot;hub&quot;', type: 'number' }
                ],
                id: '&quot;pk&quot;',
                root: '&quot;fields&quot;'
            };
            var dataAdapter = new $.jqx.dataAdapter(source)
            //initialize jqxGrid
            $("#grid").jqxGrid(
            {
                source: dataAdapter,
                showstatusbar: true,
                editable: false,
                columns:
                [
                    { text: 'Device Name', columntype: 'textbox', datafield: '&quot;device_name&quot;', width: 100 },
                    { text: 'VID/PID', columntype: 'textbox', datafield: '&quot;vid_pid&quot;', width: 50 },
                    { text: 'Install', columntype: 'textbox', datafield: '&quot;install&quot;', width: 50 },
                    { text: 'Disk Device', columntype: 'textbox', datafield: '&quot;disk_device&quot;', width: 50 },
                    { text: 'Volume Device', columntype: 'textbox', datafield: '&quot;volume_device&quot;', width: 50 },
                    { text: 'Type', columntype: 'textbox', datafield: '&quot;usb_type&quot;', width: 100 },
                    { text: 'VID', columntype: 'textbox', datafield: '&quot;vid&quot;', width: 100 },
                    { text: 'PID', columntype: 'textbox', datafield: '&quot;pid&quot;', width: 100 },
                    { text: 'Hub', datafield: '&quot;hub&quot;', cellsalign: 'right', cellsformat: 'n2' }
                ]        
                caption: "Test"
            });
        });
    </script>
    </head>
    <body>
    <div id='jqxWidget'>
        <div id="grid"></div>
    </div>
    </body>
    </html>
    

    The data variable is initialized in the very first line of the script:

    var data = “{{usb_data}}”;

    And here is the code which I see when I go to the “View->Source” menu in IE:

    
    <!DOCTYPE html>
    <html>
    <head>
    <title>Test</title>
     
    <link rel="stylesheet" href="/static/jqwidgets-ver3.1.0/jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="/static/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.sort.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.filter.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.aggregates.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.selection.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.pager.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.grouping.js"></script>
    <script type="text/javascript"> 
        var data = "[{&quot;pk&quot;: 1, &quot;model&quot;: &quot;displayusbdata.usb&quot;, &quot;fields&quot;: {&quot;vid&quot;: &quot;#1058&quot;, &quot;pid&quot;: &quot;#0748&quot;, &quot;evidence&quot;: 5, &quot;vol_serial5&quot;: &quot;-&quot;, &quot;vol_serial4&quot;: &quot;-&quot;, &quot;vol_serial1&quot;: &quot;                                        &quot;, &quot;vol_serial3&quot;: &quot;-&quot;, &quot;vol_serial2&quot;: &quot;-&quot;, &quot;port&quot;: 3, &quot;last_modify_regtime3&quot;: null, &quot;vol_name5&quot;: &quot;-&quot;, &quot;disk_device&quot;: null, &quot;revision&quot;: &quot;#1019&quot;, &quot;product&quot;: &quot;ses_device&quot;, &quot;vendor&quot;: &quot;wd&quot;, &quot;last_modify_regtime5&quot;: null, &quot;hub&quot;: 4, &quot;last_modify_regtimes1&quot;: null, &quot;last_modify_regtimes2&quot;: null, &quot;volume&quot;: &quot;&quot;, &quot;user&quot;: &quot;&quot;, &quot;vid_pid&quot;: null, &quot;vol_name1&quot;: &quot;&quot;, &quot;vol_name2&quot;: &quot;-&quot;, &quot;vol_name3&quot;: &quot;-&quot;, &quot;vol_name4&quot;: &quot;-&quot;, &quot;usb_type&quot;: &quot;other&quot;, &quot;volume_device&quot;: null, &quot;last_modify_regtime4&quot;: null, &quot;device_name&quot;: &quot;wd ses_device&quot;, &quot;instance_id&quot;: &quot;57583431453732444a323437&1&quot;, &quot;install&quot;: null, &quot;volume_name&quot;: &quot;&quot;, &quot;volume_guid&quot;: &quot;&quot;, &quot;user_datetime&quot;: null}}, {&quot;pk&quot;: 2, &quot;model&quot;: &quot;displayusbdata.usb&quot;, &quot;fields&quot;: {&quot;vid&quot;: &quot;#1058&quot;, &quot;pid&quot;: &quot;#0748&quot;, &quot;evidence&quot;: 5, &quot;vol_serial5&quot;: &quot;-&quot;, &quot;vol_serial4&quot;: &quot;-&quot;, &quot;vol_serial1&quot;: &quot;                                        &quot;, &quot;vol_serial3&quot;: &quot;-&quot;, &quot;vol_serial2&quot;: &quot;-&quot;, &quot;port&quot;: 3, &quot;last_modify_regtime3&quot;: null, &quot;vol_name5&quot;: &quot;-&quot;, &quot;disk_device&quot;: null, &quot;revision&quot;: &quot;#1019&quot;, &quot;product&quot;: &quot;ses_device&quot;, &quot;vendor&quot;: &quot;wd&quot;, &quot;last_modify_regtime5&quot;: null, &quot;hub&quot;: 4, &quot;last_modify_regtimes1&quot;: null, &quot;last_modify_regtimes2&quot;: null, &quot;volume&quot;: &quot;&quot;, &quot;user&quot;: &quot;&quot;, &quot;vid_pid&quot;: null, &quot;vol_name1&quot;: &quot;&quot;, &quot;vol_name2&quot;: &quot;-&quot;, &quot;vol_name3&quot;: &quot;-&quot;, &quot;vol_name4&quot;: &quot;-&quot;, &quot;usb_type&quot;: &quot;other&quot;, &quot;volume_device&quot;: null, &quot;last_modify_regtime4&quot;: null, &quot;device_name&quot;: &quot;wd ses_device&quot;, &quot;instance_id&quot;: &quot;575834314537325538343836&1&quot;, &quot;install&quot;: null, &quot;volume_name&quot;: &quot;&quot;, &quot;volume_guid&quot;: &quot;&quot;, &quot;user_datetime&quot;: null} }]";
        $(document).ready(function(){
            var source =
            {
                localdata: data,
                datatype: "json",
                datafields:
                [
                    { name: '&quot;device_name&quot;', type: 'string' },
                    { name: '&quot;vid_pid&quot;', type: 'date' },
                    { name: '&quot;install&quot;', type: 'date' },
                    { name: '&quot;disk_device&quot;', type: 'date' },
                    { name: '&quot;volume_device&quot;', type: 'date' },
                    { name: '&quot;usb_type&quot;', type: 'string' },
                    { name: '&quot;vid&quot;', type: 'string' },
                    { name: '&quot;pid&quot;', type: 'string' },
                    { name: '&quot;hub&quot;', type: 'number' }
                ],
                id: '&quot;pk&quot;',
                root: '&quot;fields&quot;'
            };
            var dataAdapter = new $.jqx.dataAdapter(source)
            //initialize jqxGrid
            $("#grid").jqxGrid(
            {
                source: dataAdapter,
                showstatusbar: true,
                editable: false,
                columns:
                [
                    { text: 'Device Name', columntype: 'textbox', datafield: '&quot;device_name&quot;', width: 100 },
                    { text: 'VID/PID', columntype: 'textbox', datafield: '&quot;vid_pid&quot;', width: 50 },
                    { text: 'Install', columntype: 'textbox', datafield: '&quot;install&quot;', width: 50 },
                    { text: 'Disk Device', columntype: 'textbox', datafield: '&quot;disk_device&quot;', width: 50 },
                    { text: 'Volume Device', columntype: 'textbox', datafield: '&quot;volume_device&quot;', width: 50 },
                    { text: 'Type', columntype: 'textbox', datafield: '&quot;usb_type&quot;', width: 100 },
                    { text: 'VID', columntype: 'textbox', datafield: '&quot;vid&quot;', width: 100 },
                    { text: 'PID', columntype: 'textbox', datafield: '&quot;pid&quot;', width: 100 },
                    { text: 'Hub', datafield: '&quot;hub&quot;', cellsalign: 'right', cellsformat: 'n2' }
                ]        
                caption: "Test"
            });
        });
    </script>
    </head>
    <body>
    <div id='jqxWidget'>
        <div id="grid"></div>
    </div>
    </body>
    </html>
    

    Do you see a problem with the code or do you want more code?
    If you do, please tell me what it is and I will post it.

    Thank you.

    in reply to: Binding JSON data to jqxGrid Binding JSON data to jqxGrid #47859

    oneeyeman
    Participant

    Peter,
    data is initialized.
    Just look at my first post in the thread…

    Thank you.

    in reply to: Binding JSON data to jqxGrid Binding JSON data to jqxGrid #47816

    oneeyeman
    Participant

    Hi, Peter,
    I read thru the link and this is what I came up with:

    
    <!DOCTYPE html>
    <html>
    <head>
    <title>Test</title>
    {% load staticfiles %}
    <link rel="stylesheet" href="{% static "jqwidgets-ver3.1.0/jqwidgets/styles/jqx.base.css" %}" type="text/css" />
    <script type="text/javascript" src="{% static "jquery-1.10.2.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxcore.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxdata.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxscrollbar.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxgrid.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxgrid.sort.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxgrid.filter.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxgrid.aggregates.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxgrid.selection.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxgrid.pager.js" %}"></script>
    <script type="text/javascript" src="{% static "jqwidgets-ver3.1.0/jqwidgets/jqxgrid.grouping.js" %}"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            var source =
            {
                localdata: data,
                datatype: "json",
                datafields:
                [
                    { name: '&quot;device_name&quot;', type: 'string' },
                    { name: '&quot;vid_pid&quot;', type: 'date' },
                    { name: '&quot;install&quot;', type: 'date' },
                    { name: '&quot;disk_device&quot;', type: 'date' },
                    { name: '&quot;volume_device&quot;', type: 'date' },
                    { name: '&quot;usb_type&quot;', type: 'string' },
                    { name: '&quot;vid&quot;', type: 'string' },
                    { name: '&quot;pid&quot;', type: 'string' },
                    { name: '&quot;hub&quot;', type: 'number' }
                ],
                id: '&quot;pk&quot;',
                root: '&quot;fields&quot;'
            };
            var dataAdapter = new $.jqx.dataAdapter(source)
            //initialize jqxGrid
            $("#grid").jqxGrid(
            {
                source: dataAdapter,
                showstatusbar: true,
                editable: false,
                columns:
                [
                    { text: 'Device Name', columntype: 'textbox', datafield: '&quot;device_name&quot;', width: 100 },
                    { text: 'VID/PID', columntype: 'textbox', datafield: '&quot;vid_pid&quot;', width: 50 },
                    { text: 'Install', columntype: 'textbox', datafield: '&quot;install&quot;', width: 50 },
                    { text: 'Disk Device', columntype: 'textbox', datafield: '&quot;disk_device&quot;', width: 50 },
                    { text: 'Volume Device', columntype: 'textbox', datafield: '&quot;volume_device&quot;', width: 50 },
                    { text: 'Type', columntype: 'textbox', datafield: '&quot;usb_type&quot;', width: 100 },
                    { text: 'VID', columntype: 'textbox', datafield: '&quot;vid&quot;', width: 100 },
                    { text: 'PID', columntype: 'textbox', datafield: '&quot;pid&quot;', width: 100 },
                    { text: 'Hub', datafield: '&quot;hub&quot;', cellsalign: 'right', cellsformat: 'n2' }
                ]        
                caption: "Test"
            });
        });
    

    but the page is still empty.

    What am I missing?

    Thank you.


    oneeyeman
    Participant

    Hi, Peter,
    I added what is missing on the index.html.
    Now going to the “View->Source” I see following:

    
    <!DOCTYPE html>
    <html>
    <head>
    <title>Test</title>
     
    <link rel="stylesheet" href="/static/jqwidgets-ver3.1.0/jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="/static/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.sort.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.filter.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.aggregates.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.selection.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.pager.js"></script>
    <script type="text/javascript" src="/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.grouping.js"></script>
    <script type="text/javascript"> 
        var data = "[<USB: other>, <USB: other>, <USB: other>, <USB: other>, <USB: other>, <USB: disk>, <USB: disk>, <USB: disk>, <USB: disk>, <USB: disk>, <USB: disk>, <USB: disk>, <USB: disk>, <USB: disk>, <USB: disk>, <USB: disk>, <USB: disk>, <USB: disk>, <USB: disk>, <USB: disk>, '...(remaining elements truncated)...']";
        $(document).ready(function(){
            var source =
            {
                localdata: data,
                datatype: "array",
                datafields:
                [
                    { name: 'device_name', type: 'string' },
                    { name: 'vid_pid', type: 'string' },
                    { name: 'install', type: 'string' },
                    { name: 'disk_device', type: 'string' },
                    { name: 'volume_device', type: 'string' },
                    { name: 'usb_type', type: 'string' },
                    { name: 'vid', type: 'string' },
                    { name: 'pid', type: 'string' },
                    { name: 'hub', type: 'number' }
                ]
            };
            var dataAdapter = new $.jqx.dataAdapter(source)
            //initialize jqxGrid
            $("#grid").jqxGrid(
            {
                source: dataAdapter,
                showstatusbar: true,
                editable: false,
                columns:
                [
                    { text: 'Device Name', columntype: 'textbox', datafield: 'device_name', width: 100 },
                    { text: 'VID/PID', columntype: 'textbox', datafield: 'vid_pid', width: 50 },
                    { text: 'Install', columntype: 'textbox', datafield: 'install', width: 50 },
                    { text: 'Disk Device', columntype: 'textbox', datafield: 'disk_device', width: 50 },
                    { text: 'Volume Device', columntype: 'textbox', datafield: 'volume_device', width: 50 },
                    { text: 'Type', columntype: 'textbox', datafield: 'usb_type', width: 100 },
                    { text: 'VID', columntype: 'textbox', datafield: 'vid', width: 100 },
                    { text: 'PID', columntype: 'textbox', datafield: 'pid', width: 100 },
                    { text: 'Hub', datafield: 'hub', cellsalign: 'right', cellsformat: 'n2' }
                ]        
                caption: "Test"
            });
        });
    </script>
    </head>
    <body>
    <div id='jqxWidget'>
        <div id="grid"></div>
    </div>
    </body>
    </html>
    

    and the page is still blank.
    What I think is happening is that I need to bind the “data” array to the columns data.

    Any idea?
    Thank you.

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