jQWidgets Forums

Forum Replies Created

Viewing 3 posts - 16 through 18 (of 18 total)
  • Author
    Posts
  • in reply to: A lot of data to represet A lot of data to represet #51722

    lev_povolotsky
    Participant

    I don’t succeed
    I use that code but instead with jsonp and I don’t succeed.
    please help me

    I took exactly that
    <!DOCTYPE html>
    <html lang=”en”>
    <head>
    <title id=’Description’>In this example the Grid is bound to a Remote Data.</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/jqxlistbox.js”></script>
    <script type=”text/javascript” src=”/jqwidgets/jqxdropdownlist.js”></script>
    <script type=”text/javascript” src=”/jqwidgets/jqxmenu.js”></script>
    <script type=”text/javascript” src=”/jqwidgets/jqxdata.js”></script>
    <script type=”text/javascript” src=”/jqwidgets/jqxgrid.js”></script>
    <script type=”text/javascript” src=”/jqwidgets/jqxgrid.pager.js”></script>
    <script type=”text/javascript” src=”/jqwidgets/jqxgrid.sort.js”></script>
    <script type=”text/javascript” src=”/jqwidgets/jqxgrid.filter.js”></script>
    <script type=”text/javascript” src=”/jqwidgets/jqxgrid.columnsresize.js”></script>
    <script type=”text/javascript” src=”/jqwidgets/jqxgrid.selection.js”></script>
    <script type=”text/javascript” src=”/jqwidgets/jqxpanel.js”></script>
    <script type=”text/javascript” src=”/jqwidgets/jqxdatatable.js”></script>
    <script type=”text/javascript” src=”/scripts/demos.js”></script>
    <script type=”text/javascript”>
    $(document).ready(function () {
    var source =
    {

    dataType: “jsonp”,
    datafields : [
    { name: ‘CompanyName’},
    { name: ‘ContactName’},
    { name: ‘ContactTitle’},
    { name: ‘Address’},
    { name: ‘City’},
    { name: ‘Country’}
    ],
    id: ‘runId’,
    url: “http://localhost:9998/test/runs”
    };

    var dataAdapter = new $.jqx.dataAdapter(source, { async: false, autoBind: true });
    var records = dataAdapter.records;
    // UI Stuff
    $(“#jqxgrid”).jqxGrid(
    {
    width: 1200,
    height: 850,
    source: dataAdapter,
    theme: theme,

    virtualmode: true,
    rendergridrows: function (params) {
    var start = params.startindex;
    var end = params.endindex;
    var array = new Array();
    for (i = start; i < end; i++) {
    array[i] = records[i];
    }
    return array;
    },
    columns: [
    { text: ‘Company Name’, datafield: ‘CompanyName’, width: 250 },
    { text: ‘Contact Name’, datafield: ‘ContactName’, width: 200 },
    { text: ‘Contact Title’, datafield: ‘ContactTitle’, width: 200 },
    { text: ‘Address’, datafield: ‘Address’, width: 180 },
    { text: ‘City’, datafield: ‘City’, width: 100 },
    { text: ‘Country’, datafield: ‘Country’, width: 140 }
    ]
    });

    });
    </script>
    </head>
    <body class=’default’>
    <div id=’jqxWidget’ style=”font-size: 13px; font-family: Verdana; float: left;”>
    <div id=”jqxgrid”></div>
    </div>
    </body>
    </html>

    in reply to: JSONP with knockout JSONP with knockout #51490

    lev_povolotsky
    Participant

    but I try to parse JSONP, and founded that I shouldn’t parse it just need to insert it.

    moreover I succeed to load the data into me.items(data) and it’s works.

    The issue now that it doesn’t repreasnt me the data and I don’t know why

    I use exactly these code but diffrent columns and it doesn’t represnt me it and I don’t have any error
    `
    var model = new GridModel();
    // prepare the data
    var source =
    {
    datatype: “observablearray”,
    datafields: [
    { name: ‘name’ },
    { name: ‘type’ },
    { name: ‘calories’, type: ‘int’ },
    { name: ‘totalfat’ },
    { name: ‘protein’ },
    ],
    id: ‘id’,
    localdata: model.items
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    $(“#grid”).jqxGrid(
    {
    width: 670,
    source: dataAdapter,
    columns: [
    { text: ‘Name’, datafield: ‘name’, width: 250 },
    { text: ‘Beverage Type’, datafield: ‘type’, width: 250 },
    { text: ‘Calories’, datafield: ‘calories’, width: 180 },
    { text: ‘Total Fat’, datafield: ‘totalfat’, width: 120 },
    { text: ‘Protein’, datafield: ‘protein’, minwidth: 120 }
    ]
    });
    ko.applyBindings(model);
    `

    Do you know why it’s happened?

    in reply to: JSONP with knockout JSONP with knockout #51467

    lev_povolotsky
    Participant

    According to 3rd link

    I don’t succeed to parse jsonp result.
    $.parseJSON isn’t working

    as you can see here in your esample

    
     var url = "../sampledata/beverages.txt";
    
                var GridModel = function () {
                    this.items = ko.observableArray();
                    var me = this;
                    $.ajax({
                        datatype: 'json',
                        url: "../sampledata/beverages.txt"
                    }).done(function (data) {
                        var jsonData = $.parseJSON(data);
                        me.items(jsonData);
                    });
                };
    
    
Viewing 3 posts - 16 through 18 (of 18 total)