Auto save via XmlHttpRequest from EditorGridPanel in ExtJS 3.0?

I have a GridPanel editor in Ext JS 3.0 populated through HttpProxy and JsonReader, and I have an editable "working" column - I can edit the value and it marks it as dirty.

Now, how do I get, after the cell has been edited, send the XmlHttpRequest to the server with a few basic parameters, a row id field, column name and new value?

After the request has been made, server-side upgrade is easy. But no amount of Google and delving into the trivial EditGridPanel examples in memory helps get an EditGridPanel call.

What I'm not looking for:

  • REST - just update via regular GET or POST
  • Insert new records or delete rows - updates only now.
  • Batch updates - only one cell edit at a time.
  • Letter of code - this should be trivial, like Ajax.InPlaceEditor in Scriptaculous
+3
source share
2 answers

I finally figured it out ... I just need a writer in my store:

var ds = new Ext.data.JsonStore({
    autoSave:       true,
    url:            "ajax-handler.aspx",
    method:         "POST",
    timeout:        120000,
    root:           "rows",
    totalProperty:  "results",
    idProperty:     "primarykeyvalue",
    fields:         previewColumnConfig,
    baseParams:     {
        now:        (new Date()).getTime()
        },
    writer: new Ext.data.JsonWriter({
        encode:     true,
        listful:    false
        })
    });

Notes:

  • The "now" baseparam is to bypass the "some browsers" (guess) caching of AJAX results.
  • "encode" returns POST variables, not just the JSON result in POST.
  • "listful" , / , , .
  • , -.
  • ColumnConfig , .
+2

afteredit Ext.grid.EditorGridPanel, . (Interval) beforeedit afteredit.

afteredit:

EditorGridPanel.getColumnModel().getCellEditor(column).on('afteredit', function() {
    //do ajax call for the update.
});

, , .

0

Source: https://habr.com/ru/post/1713896/


All Articles