Results 1 to 2 of 2

Thread: Best way to add string values column rows that won't impact Calculations

  1. #1
    Sencha User
    Join Date
    Aug 2017
    Posts
    46
    Answers
    1
    Vote Rating
    1
      0  

    Default Answered: Best way to add string values column rows that won't impact Calculations

    I am currently using Sencha Classic ToolKit

    I am having this issue with my calculations within number in Column Rows. I am currently using Summart Render to add the numbers.

    Here is my code
    Code:
        columns: [
            {
                xtype: 'gridcolumn',
                dataIndex: 'F1132',
                text: 'Group'
            },
            {
                xtype: 'gridcolumn',
                summaryRenderer: function(val, params, data, metaData) {
                    var paymentTotal = Ext.first('#theGrid').getStore().sum('column1');
                    return '$' + paymentTotal;
    
    
                   }
                },
                summaryType: 'sum',
                dataIndex: 'column1',
                text: 'Date 1'
            },
    This works when I remove the "$" from my convert, but when I leave it on it does not make the correct calculations.
    Code:
    convert: function(v, rec) {
                    var val = rec.get('column1');
                    if (val === undefined){
                        val = '0';
                    }
                    return '$ ', val;
    
    
                },
                name: 'column1'
    I understand that the calculation will not work, because I am concatenating a string with a number, but what other way can I go about this which will output correct calculation AND also leave the "$" ?

    Thanks for the help in advance.

    Regards,

    Robzdoom

  2. I ended up figuring out the issue. I decided not to add the '$' string on convert and rather added it on the render method within the column. Within the render method, all I had to to do was add return '$' + value;
    The entire code looks like this:

    Code:
    renderer: function(value, metaData, record, rowIndex, colIndex, store, view) {
                    return '$' + value;
                }
    No I am able to add the '$' and still have my calculations within SummaryFeature.

    Thanks for the help, Community!

    Regards,

    Robzdoom

  3. #2
    Sencha User
    Join Date
    Aug 2017
    Posts
    46
    Answers
    1
    Vote Rating
    1
      0  

    Default

    I ended up figuring out the issue. I decided not to add the '$' string on convert and rather added it on the render method within the column. Within the render method, all I had to to do was add return '$' + value;
    The entire code looks like this:

    Code:
    renderer: function(value, metaData, record, rowIndex, colIndex, store, view) {
                    return '$' + value;
                }
    No I am able to add the '$' and still have my calculations within SummaryFeature.

    Thanks for the help, Community!

    Regards,

    Robzdoom

Similar Threads

  1. doFormUpload fails to get " signs
    By fafche in forum Ext:Bugs
    Replies: 1
    Last Post: 25 Jan 2012, 4:43 AM
  2. Replies: 5
    Last Post: 1 May 2009, 12:22 AM
  3. HTML Signs in Grid Cell -> IE Problem
    By Alex84 in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 13 Mar 2009, 12:19 AM
  4. radiogroups fieldLabel wont render in column layout?
    By Dr. Flink in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 22 Nov 2008, 3:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •