Results 1 to 3 of 3

Thread: calculate cells

  1. #1
    Member
    Join Date
    Dec 2009
    Location
    athens
    Posts
    14

    calculate cells

    Hi ,
    i need to calculate the sum of some cells
    to do that i use the code

    var itemsArray = stocksGrid.extractItemList();
    var sumCell = new Number(0);

    for (var i in itemsArray) {
    var c = stocksGrid.getValue(itemsArray[i],"o_Bid");
    if (c==null) c=0;
    var val = new Number(c).toFixed(4);
    sumCell += Number(val);
    }

    for the cells that are feed data from server works fine

    the problem is when i have cells with custom-data

    like

    var calc1 = A*B;
    info.setCellValue("#Cell01",calc1.toFixed(4));

    var itemsArray = stocksGrid.extractItemList();
    var sumCell = new Number(0);

    for (var i in itemsArray) {
    var c = stocksGrid.getValue(itemsArray[i],"#Cell01");
    if (c==null) c=0;
    var val = new Number(c).toFixed(4);
    sumCell += Number(val);
    }

    Thanks

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    605
    Hi betasec,

    Note that setCellValue does not update the internal model of the AbstractGrid so that if a value is set through this method it can't be used for features working on such model.

    Please replace setCellValue statement with UpdateRow; e.g.:


  3. #3
    Member
    Join Date
    Dec 2009
    Location
    athens
    Posts
    14
    Hi
    this works fine
    Thanks

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 11:17 PM.