jQWidgets Forums

jQuery UI Widgets Forums Grid Get Original Value of Cell

This topic contains 4 replies, has 2 voices, and was last updated by  Rodolfo Hill 7 years, 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Get Original Value of Cell #95128

    Rodolfo Hill
    Participant

    I try to get the original value of the grid cell, not the value displayed.
    When I try to get the value of the cell, returns the label, not the value. Not return the real value came from Source / Adapter.

    var standardTypeSource =
    {
    datatype: “json”,
    datafields: [
    // name – determines the field’s name.
    // value – the field’s value in the data source.
    // values – specifies the field’s values.
    // values.source – specifies the foreign source. The expected value is an array.
    // values.value – specifies the field’s value in the foreign source.
    // values.name – specifies the field’s name in the foreign source.
    // When the adapter is loaded, each record will have a field called “Country”. The “Country” for each record comes from the countriesAdapter where the record’s “countryCode” from gridAdapter matches to the “value” from countriesAdapter.
    { name: ‘standardTypeId’, type: ‘number’ },
    { name: ‘name’, type: ‘string’ }
    ],
    id: ‘standardTypeId’,
    url: “/getStandardType”,
    type: “GET”,
    async: false
    }

    var standardTypeAdapter = new $.jqx.dataAdapter(standardTypeSource, { autoBind: true });

    var standardSource =
    {
    datatype: “json”,
    datafields: [
    // name – determines the field’s name.
    // value – the field’s value in the data source.
    // values – specifies the field’s values.
    // values.source – specifies the foreign source. The expected value is an array.
    // values.value – specifies the field’s value in the foreign source.
    // values.name – specifies the field’s name in the foreign source.
    // When the adapter is loaded, each record will have a field called “Country”. The “Country” for each record comes from the countriesAdapter where the record’s “countryCode” from gridAdapter matches to the “value” from countriesAdapter.
    { name: ‘standardId’, type:’number’ },
    { name: ‘standardTypeId’, type:’number’, values: { source: standardTypeAdapter.records, value: ‘standardTypeId’, name: ‘name’ }},
    { name: ‘enterpriseId’, type:’number’ },
    { name: ‘name’, type: ‘string’ },
    { name: ‘main’, type: ‘string’ },
    { name: ‘description’, type: ‘string’ },
    { name: ‘version’, type: ‘string’ },
    { name: ‘issueDate’, type: ‘string’ },
    { name: ‘dueDate’, type: ‘string’ }
    ],
    id: ‘standardId’,
    url: “/bringStandardRows”,
    root: ‘rows’,
    type: “GET”,
    async: false,
    addrow: function (rowid, rowdata, position, commit) {
    // synchronize with the server – send insert command
    // call commit with parameter true if the synchronization with the server is successful
    //and with parameter false if the synchronization failed.
    // you can pass additional argument to the commit callback which represents the new ID if it is generated from a DB.
    commit(true);
    },
    deleterow: function (rowid, commit) {
    // synchronize with the server – send delete command
    // call commit with parameter true if the synchronization with the server is successful
    //and with parameter false if the synchronization failed.
    commit(true);
    },
    updaterow: function (rowid, newdata, commit) {
    // synchronize with the server – send update command
    // call commit with parameter true if the synchronization with the server is successful
    // and with parameter false if the synchronization failed.
    commit(true);
    },
    beforeprocessing: function(data)
    {
    standardSource.totalrecords = data[0].totalRows;
    },
    pager: function (pagenum, pagesize, oldpagenum) {
    // callback called when a page or page size is changed.
    //alert(“hubo movimiento en el pager”);
    }
    }

    var standardAdapter = new $.jqx.dataAdapter(standardSource, { autoBind: true });

    I also analized all the elements of the dataRecord, and do not appear the original value, appear the displayed value (label).

    //var selectedrowindex = $(“#jqxgrid”).jqxGrid(‘getselectedrowindex’);
    var rowindex = $(“#standardGrid”).jqxGrid(‘getselectedrowindex’);
    var rowid = $(“#standardGrid”).jqxGrid(‘getrowid’, rowindex);

    editrow = rowindex;

    var offset = $(“#standardGrid”).offset();
    alert(“offset = ” + offset);

    var dataRecord = $(“#standardGrid”).jqxGrid(‘getrowdata’, editrow);

    var out = ”;
    for (var p in dataRecord) {
    out += p + ‘: ‘ + dataRecord[p] + ‘\n’;
    }
    console.log(“dataRecord = ” + out);

    console.log(“Con rowindex = ” + rowindex);
    var valueFromGetCellValue = $(‘#standardGrid’).jqxGrid(‘getcellvalue’, rowindex, “standardTypeId”);
    var valueFromGetCellText = $(‘#standardGrid’).jqxGrid(‘getcelltext’, rowindex, “standardTypeId”);
    console.log(“valueFromGetCellValue = ” + valueFromGetCellValue);
    console.log(“valueFromGetCellText = ” + valueFromGetCellText);

    //var Value = $(‘#jqxgrid’).jqxGrid(‘getcellvalue’, row, ‘ID’);

    console.log(“Con rowid = ” + rowid);
    var valueFromGetCellValueById = $(‘#standardGrid’).jqxGrid(‘getcellvaluebyid’, rowid, “standardTypeId”);
    var valueFromGetCellTextById = $(‘#standardGrid’).jqxGrid(‘getcelltextbyid’, rowid, “standardTypeId”);
    console.log(“valueFromGetCellValueById = ” + valueFromGetCellValueById);
    console.log(“valueFromGetCellTextById = ” + valueFromGetCellTextById);

    allways appear:

    dataRecord = standardId: 6
    standardTypeId: Caracteristica
    enterpriseId: 0
    name: Disuadir el acceso furtivo.
    main: A.1.3.
    description:
    version: 1.0.0
    issueDate: 2017-07-11
    dueDate: 2017-07-11
    uid: 6
    boundindex: 6
    uniqueid: 2117-16-24-31-162225
    visibleindex: 6

    Con rowindex = 6
    valueFromGetCellValue = Caracteristica
    valueFromGetCellText = Caracteristica
    Con rowid = 6
    valueFromGetCellValueById = Caracteristica
    valueFromGetCellTextById = Caracteristica

    Never appear the value of standardTypeId

    Get Original Value of Cell #95150

    Stanislav
    Participant

    Hello Rodolfo Hill,

    You can use our API getcell, with it you can get the element as an object using: console.dir(cell).
    There you can see the value. After that, you can easily access it with console.log(cell.value);.

    Best Regards,
    Stanislav

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

    Get Original Value of Cell #95161

    Rodolfo Hill
    Participant

    I have a column defined with values, like:

    { name: ‘standardTypeId’, type:’number’, values: { source: standardTypeAdapter.records, value: ‘standardTypeId’, name: ‘name’ }},

    If I, use:

    var value = $(‘#standardGrid’).jqxGrid(‘getcellvalue’, rowindex, “standardTypeId”);

    Always return me always return to me the name and not the real value

    I use jqwidgets.4.2.1 and jquery-3.2.1, but with jqwidgets.4.5.0 and jqwidgets.4.5.4 I had the same result.

    Get Original Value of Cell #95163

    Rodolfo Hill
    Participant

    I change the jqwidgets version to jqwidgets.4.5.4 because the version jqwidgets.4.2.1 does not have tabs on popup windows.

    It continue without running.

    Get Original Value of Cell #95178

    Rodolfo Hill
    Participant

    Please Help Me

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

You must be logged in to reply to this topic.