[CLOSED] Set cell value in grid from handler

  1. #1

    [CLOSED] Set cell value in grid from handler

    I am not able to change the string value of a cell in my grid.

    Here is the code from the button listener handler...

    =================
    #{GridPanel1}.getRowEditor().startEditing(thisRecID);
    alert('before=' + #{GridPanel1}.getSelectionModel().getSelected().get('Active'));
    #{GridPanel1}.getSelectionModel().getSelected().set('Active','false');
    #{GridPanel1}.getRowEditor().stopEditing();
    alert('after=' + #{GridPanel1}.getSelectionModel().getSelected().get('Active'));
    =================

    Both before and after alert shows the same value. No javascript error, but the cell is marked as dirty and fires OnBeforeStoreChanged when the grid is saved. Saves the old value and not the new value 'false' that I am trying to set.

    Appreciate your help.

    - Naren
    Last edited by Daniil; Sep 03, 2010 at 6:30 PM. Reason: [CLOSED]
  2. #2
    Hello!

    The dirty flag is setted after executing line #3.
    #{GridPanel1}.getSelectionModel().getSelected().set('Active','false');
    But the new value is reseted after executing line #4
    #{GridPanel1}.getRowEditor().stopEditing();
    because of it gets a new value for the record from the RowEditor's field. Its value was set during invoking the startEditing method. So, there is the old value.

    Are you sure that you have to use startEditing and stopEditing methods? To change value you could just use something like this:
    #{GridPanel1}.getStore().getAt(rowIndex).set('dataIndex', 'newValue')
  3. #3

    Problem solved

    Daniil,

    Thank you for your support.

    I used the rowIndex to update the store which automatically set the dirty flag.

    - Naren

Similar Threads

  1. Replies: 0
    Last Post: May 12, 2012, 11:24 AM
  2. [CLOSED] CSS property for grid cell
    By gets_gui in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 11, 2012, 5:48 PM
  3. Replies: 6
    Last Post: Sep 21, 2011, 9:37 AM
  4. [CLOSED] Change the value of a grid cell
    By tms in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 15, 2010, 7:43 AM
  5. [CLOSED] select grid rows with ajax handler
    By hillscottc in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 07, 2010, 4:46 PM

Tags for this Thread

Posting Permissions