jQWidgets Forums

jQuery UI Widgets Forums Grid How to retrieve XML ID attribute

This topic contains 1 reply, has 1 voice, and was last updated by  matzgroup 11 years, 12 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • How to retrieve XML ID attribute #22058

    matzgroup
    Member

    I am using XML datasource to display the grid. I am adding a hyperlink to one column of a row to which I want to pass the row data ID (not row ID) which is an attribute but not a datafield. Can anyone please help me on this.

    From the code below I want the attribute EntityID to be passed to the column href. I have highlighted the requirement in red below.

    Here is the XML:
    <entity EntityID=”5″>Chrisitan OrganizationPastor Comfort PeramNoBorn AgainIndiaAndhra Pradesh919999999999sunil@matzgroup.in

    Here is the code:
    $(document).ready(function () {
    var theme = ‘energyblue’;
    var pagesize = 10;

    var url = “/content/entity-list.xml”;

    // prepare the data
    var source =
    {
    datatype: “xml”,
    datafields: [
    { name: ‘ContactType’, type: ‘string’ },
    { name: ‘FullName’, type: ‘string’ },
    { name: ‘Vvip’, type: ‘string’ },
    { name: ‘Denomination’, type: ‘string’ },
    { name: ‘Country’, type: ‘string’ },
    { name: ‘State’, type: ‘string’ },
    { name: ‘Mobile’, type: ‘string’ },
    { name: ‘Email’, type: ‘string’ }
    ],
    root: “Entities”,
    record: “Entity”,
    <span style="color: red;”>id: ‘EntityID’,
    url: url
    };
    var dataAdapter = new $.jqx.dataAdapter(source, {
    downloadComplete: function (data, status, xhr) { },
    loadComplete: function (data) { },
    loadError: function (xhr, status, error) { }
    });

    var columnCheckBox = null;
    var updatingCheckState = false;

    var cellsrenderer = function (id, row, column, value) {
    return ‘<a href="/jsp/entityInfo.jsp?entityId=' + <s pan style=”color: red;”>id + ‘” style=”margin-left:5px;color:blue;” target=”_top”>’ + value + ”;
    }
    var columnrenderer = function (id, value) {
    return ‘<a href="/jsp/entityInfo.jsp?entityId=' + <s pan style=”color: red;”>id + ‘” style=”margin-left:5px;color:blue;” target=”_top”>’ + value + ”;
    }

    // initialize jqxGrid
    $(“#jqxgrid”).jqxGrid(
    {
    width: 1148,
    source: dataAdapter,
    editable: false,
    theme: theme,
    pageable: true,
    autoheight: true,
    sortable: true,
    altrows: true,
    columnsresize: true,
    filterable: true,
    enabletooltips: true,
    pagesizeoptions: [‘5′, ’10’],
    pagesize: pagesize,
    enablehover: true,
    selectionmode: ‘none’,
    columns: [
    { text: ”, datafield: ‘available’, columntype: ‘checkbox’, width: 40,
    renderer: function () {
    return ‘

    ‘;
    },
    rendered: function (element) {
    $(element).jqxCheckBox({ theme: theme, width: 16, height: 16, animationShowDelay: 0, animationHideDelay: 0 });
    columnCheckBox = $(element);
    $(element).on(‘change’, function (event) {
    var checked = event.args.checked;
    if (checked == null || updatingCheckState) return;
    var rowscount = $(“#jqxgrid”).jqxGrid(‘getdatainformation’).rowscount;
    $(“#jqxgrid”).jqxGrid(‘beginupdate’);

    if (checked) {
    $(“#jqxgrid”).jqxGrid(‘selectallrows’);
    }
    else if (checked == false) {
    $(“#jqxgrid”).jqxGrid(‘clearselection’);
    }

    for (var i = 0; i < rowscount; i++) {
    $("#jqxgrid").jqxGrid('setcellvalue', i, 'available', event.args.checked);
    }

    $("#jqxgrid").jqxGrid('endupdate');
    });
    return true;
    }
    },
    { text: 'Contact Type’, datafield: ‘ContactType’, width: 120 },
    { text: ‘
    Full Name‘, datafield: ‘FullName’, renderer: columnrenderer, cellsrenderer: cellsrenderer, width: 190 },
    { text: ‘VVIP‘, datafield: ‘Vvip’, width: 70, align: ‘center’, cellsalign: ‘center’},
    { text: ‘Denomination‘, datafield: ‘Denomination’, width: 140 },
    { text: ‘Country‘, datafield: ‘Country’, width: 120 },
    { text: ‘State‘, datafield: ‘State’, width: 120 },
    { text: ‘Mobile‘, datafield: ‘Mobile’, width: 140 },
    { text: ‘Email‘, datafield: ‘Email’, width: 208 },
    ]
    });

    How to retrieve XML ID attribute #22087

    matzgroup
    Member

    Dear Team,
    Can anyone please help me in this issue. My project is currently stuck at this point.

    Regards,
    Sunil

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

You must be logged in to reply to this topic.