1. #1
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    4
    Vote Rating
    1
    vitorvti is on a distinguished road

      0  

    Default Set celleditor editable when adding a new row

    Set celleditor editable when adding a new row


    I have this issue, appears to be easy but i just don't know how to do this.
    I created an add event on my controller:

    ...

    init: function(application) {
    this.control({
    "gridpanel#usuarios": {
    edit: this.onGridpanelEdit,
    deleteRecord: this.onGridpanelDeleteRecord,
    addRecord: this.onGridpanelAddRecord
    }
    });
    }

    onGridpanelAddRecord: function(params, eventOptions) {
    console.log('add record');
    var grid = this.getGrid();
    var model = this.getModel('Usuario');
    var newRecord = model.create();
    var store = this.getStore('Usuarios');
    // insert into store and start editing that record
    newRecord = store.insert(0, newRecord);
    //so far everything is ok


    // here i need to set the cell editor editable before start editing, the column editor 1 was previously configured to readonly=true

    // and then start edit
    grid.editingPlugin.startEdit(0,1);

    I already saw a lot of examples but so far nothing.
    anyone can help me?
    thanks

  2. #2
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    4
    Vote Rating
    1
    vitorvti is on a distinguished road

      0  

    Exclamation CellEditor Issue

    CellEditor Issue


    I solved how to set cell editor readOlny = false, now i get another problem.
    What i need to do is:

    I have a column Id which is not editable on load data, but it is editable when i add a new row. So i need to set the cell id editable only when i add a new row.


    Code:
    newRecord = store.insert(0, newRecord);
    //console.log(grid.columns[1]);
    grid.editingPlugin.startEdit(0,1);
    grid.editingPlugin.editors.items[0].field.setReadOnly(false);
    the problem with this code is that all the rows are with column id editable.
    So this is my problem...
    Anyone??