jQuery UI Widgets Forums Grid grid column with format

This topic contains 6 replies, has 3 voices, and was last updated by  Dimitar 10 years, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • grid column with format #59587

    dippy
    Participant

    Hi,

    My 2 column (which are computed) values in the grid is getting committed to database as zero / 0. Although the grid displays correct values.
    below is the code { text: ‘Margin’, editable: false, datafield: ‘Mgn’,width: 65,
    cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
    if ((parseFloat(rowdata.FinalRSP)>0) && parseFloat(rowdata.EstTerrLndCst)>0)
    {
    var FinalRSPNetVat=((parseFloat(rowdata.FinalRSP)*100)/(100+parseFloat(rowdata.VATPer)));
    var mrgn = ((parseFloat(FinalRSPNetVat)-parseFloat(rowdata.EstTerrLndCst))/parseFloat(FinalRSPNetVat))*100;
    return “<div class=’jqx-right-align’>” + dataAdapter.formatNumber(mrgn, “p2”) + “</div>”;
    }
    }
    },
    { text: ‘Markup’, editable: false, datafield: ‘Mup’,width: 65,
    cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata)
    {
    if (parseFloat(rowdata.FinalRSP)>0 && parseFloat(rowdata.EstTerrLndCst)>0)
    {
    var FinalRSPNetVat=((parseFloat(rowdata.FinalRSP)*100)/(100+parseFloat(rowdata.VATPer)));
    var mrkup = ((parseFloat(FinalRSPNetVat)-parseFloat(rowdata.EstTerrLndCst))/parseFloat(rowdata.EstTerrLndCst))*100;
    return “<div class=’jqx-right-align’>” + dataAdapter.formatNumber(mrkup, “p2”) + “</div>”;
    }
    }`

    Please note hthe formatNumber is “p2”. Please advice

    grid column with format #59589

    dippy
    Participant

    Repasting the code

    { text: 'Margin', editable: false, datafield: 'Mgn',width: 65,
                          cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
    						 if ((parseFloat(rowdata.FinalRSP)>0) && parseFloat(rowdata.EstTerrLndCst)>0)
    						 {
    						  var FinalRSPNetVat=((parseFloat(rowdata.FinalRSP)*100)/(100+parseFloat(rowdata.VATPer)));
                              var mrgn = ((parseFloat(FinalRSPNetVat)-parseFloat(rowdata.EstTerrLndCst))/parseFloat(FinalRSPNetVat))*100;
    						  return "<div class='jqx-right-align'>" + dataAdapter.formatNumber(mrgn, "p2") + "</div>";
                             }						                        
                          }
                      },
    				  { text: 'Markup', editable: false, datafield: 'Mup',width: 65,
                          cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) 
    					  {
    						 if (parseFloat(rowdata.FinalRSP)>0 &&  parseFloat(rowdata.EstTerrLndCst)>0)
    						 {
    						  var FinalRSPNetVat=((parseFloat(rowdata.FinalRSP)*100)/(100+parseFloat(rowdata.VATPer)));
                              var mrkup = ((parseFloat(FinalRSPNetVat)-parseFloat(rowdata.EstTerrLndCst))/parseFloat(rowdata.EstTerrLndCst))*100;
    						  return "<div class='jqx-right-align'>" + dataAdapter.formatNumber(mrkup, "p2") + "</div>";
                             }						                       
                        }
    grid column with format #59590

    supun151515
    Participant

    Hello dippy,

    Your question is not clear. try to make a demo in http://jsfiddle.net

    Thank you,
    Supun Silva

    grid column with format #59601

    Dimitar
    Participant

    Hello dippy,

    A computed column, as implemented in the demo of the same name, does not have actual cell values (it is not bound to an existing datafield). Cells only appear to have values through cellsrenderer but they cannot be used for commit to database, sort or any purpose other than viewing.

    Some other suggestions on computed column implementation can be found in the forum topic Computed Column that will sort and use the cellclass.

    Best Regards,
    Dimitar

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

    grid column with format #59782

    dippy
    Participant

    Dear Dimitar,

    Thanks for your reply. I have database fields for the 2 computed columns mentioned above, grid displays correct data as % and when commit i can see a value zero value getting committed in alert message. The database also shows zero value. M

    Below is the code

    updaterow: function (rowid, rowdata, commit)
    {	
    var data = "update=true&" + $.param(rowdata);
      alert(data);

    My problem is it does not show correct % value in the alert message.Other columns values are correct. Do i need to bind the computed data values explicitly.

    Please advice.

    regards

    grid column with format #59813

    dippy
    Participant

    Hi

    Any help ? Please

    grid column with format #59895

    Dimitar
    Participant

    Hi dippy,

    Are the displayed cell values of your computed columns loaded from the database or computed through cellsrenderer? In the latter case, please read my previous post again and refer to the linked topic for possible solutions.

    Best Regards,
    Dimitar

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

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

You must be logged in to reply to this topic.