jQuery UI Widgets Forums Grid Array in cell grid

This topic contains 2 replies, has 2 voices, and was last updated by  wUser 9 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Array in cell grid #72982

    wUser
    Participant

    Hello,

    how to show an arrays into cell grid?

    thx.

    Array in cell grid #72991

    Dimitar
    Participant

    Hello wUser,

    Here is how to load an array in a grid cell:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
        <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcore.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/jqxgrid.columnsresize.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
        <script type="text/javascript" src="../../scripts/demos.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                var sampleData = [{ name: 'John', jobs: ['Programmer', 'Manager'] }, { name: 'Clara', jobs: ['Teacher', 'Caretaker', 'Barmaid']}];
    
                var source =
                {
                    datatype: "json",
                    datafields: [
                        { name: 'name', type: 'string' },
                        { name: 'jobs', type: 'array' }
                    ],
                    localdata: sampleData
                };
                var dataAdapter = new $.jqx.dataAdapter(source);
    
                $("#jqxgrid").jqxGrid(
                {
                    width: 850,
                    source: dataAdapter,
                    columnsresize: true,
                    columns: [
                      { text: 'Name', datafield: 'name', width: 250 },
                      { text: 'Jobs', datafield: 'jobs', width: 250 }
                  ]
                });
            });
        </script>
    </head>
    <body class='default'>
        <div id="jqxgrid">
        </div>
    </body>
    </html>

    Best Regards,
    Dimitar

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

    Array in cell grid #72999

    wUser
    Participant

    thank you very match Dimitar

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

You must be logged in to reply to this topic.