Vítor Nóbrega
Vítor Nóbrega

Reputation: 1213

How to update record from grid with row editing active?

I have a problem with rowediting plugin in grid.

I have a grid with 5 columns and only 1 column has an editor. I am using rowediting plugin.

My editor is a textfield and I have a change listeners. Every time this textfield is changed, I need to update another column value but this is done when I finish the edition (by pressing Enter key).

I use reconfigure method from store, the rowediting is cancelled and don't want this behaviour.

How I can update my grid keeping the row edition?

Upvotes: 0

Views: 1463

Answers (1)

Igor Semin
Igor Semin

Reputation: 2496

If I understand you correctly, something like this

if (field.getKey() == field.ENTER) {
    var record = editor.ownerCt.ownerCmp.getSelectionModel().getSelection()[0],
        store = editor.ownerCt.ownerCmp.getStore(),
        newValue = editor.getValue();

    // enter key pressed
    if (record) {
        record.set("name", newValue);
        record.set("fullname", newValue + ' Simpson');
        record.commit();

        store.load();
    }
}

Fiddle

Upvotes: 1

Related Questions