jQWidgets Forums

jQuery UI Widgets Forums Grid How to have 2 Keys/Values Column?

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

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • How to have 2 Keys/Values Column? #11992

    williamtourinho
    Participant

    I had tried the following example and it has worked well. The problem is that i just cant have 2 Keys/Values Column. Only the first one show’s the displayname. The second one show’s the Id. What’s the solution?

    var theme = getTheme();
    var employeesSource =
    {
    datatype: “xml”,
    datafields: [
    { name: ‘FirstName’ },
    { name: ‘LastName’ }
    ],
    root: “Employees”,
    record: “Employee”,
    id: ‘EmployeeID’,
    url: “../sampledata/employees.xml”,
    async: false
    };
    var employeesAdapter = new $.jqx.dataAdapter(employeesSource, {
    autoBind: true,
    beforeLoadComplete: function (records) {
    var data = new Array();
    // update the loaded records. Dynamically add EmployeeName field.
    for (var i = 0; i d\\:EmployeeID’, text: ‘EmployeeName’, id: ‘EmployeeID’, source: employeesAdapter.records },
    { name: ‘EmployeeID’, map: ‘m\\:properties>d\\:EmployeeID’ },
    { name: ‘ShippedDate’, map: ‘m\\:properties>d\\:ShippedDate’, type: ‘date’ },
    { name: ‘Freight’, map: ‘m\\:properties>d\\:Freight’, type: ‘float’ },
    { name: ‘ShipName’, map: ‘m\\:properties>d\\:ShipName’ },
    { name: ‘ShipAddress’, map: ‘m\\:properties>d\\:ShipAddress’ },
    { name: ‘ShipCity’, map: ‘m\\:properties>d\\:ShipCity’ },
    { name: ‘ShipCountry’, map: ‘m\\:properties>d\\:ShipCountry’ }
    ],
    root: “entry”,
    record: “content”,
    id: ‘m\\:properties>d\\:OrderID’,
    url: “../sampledata/orders.xml”,
    pager: function (pagenum, pagesize, oldpagenum) {
    // callback called when a page or page size is changed.
    }
    };
    var ordersAdapter = new $.jqx.dataAdapter(ordersSource);
    $(“#jqxgrid”).jqxGrid(
    {
    width: 670,
    source: ordersAdapter,
    theme: theme,
    selectionmode: ‘singlecell’,
    pageable: true,
    autoheight: true,
    editable: true,
    columns: [
    { text: ‘Employee Name’, datafield: ‘EmployeeID’, displayfield: ‘EmployeeName’, columntype: ‘dropdownlist’, width: 150 },
    { text: ‘Ship City’, datafield: ‘ShipCity’, width: 150},
    { text: ‘Ship Country’, datafield: ‘ShipCountry’, width: 150 },
    { text: ‘Ship Name’, datafield: ‘ShipName’}
    ]
    });

    How to have 2 Keys/Values Column? #11998

    Peter Stoev
    Keymaster

    Hi williamtourinho,

    In the provided code, you have specified only 1 key/value column – Employee Name. We don’t have restriction on the number of columns with key/values.

    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.