Insert and update grid record from Javascript

  1. #1

    Insert and update grid record from Javascript

    I know how to insert and update record (and then go to that record) from code behind. How to do same thing from JavaScript?

    Insert:
    Store.Insert(0, Art)
    Grid.GetSelectionModel.Select(Art.ID.ToString)
    Update:
    Dim record As ModelProxy = Store.GetById(Art.ID)
    record.Set(Art)
    record.Commit()
    Grid.GetSelectionModel.Select(Art.ID.ToString)
    In both cases I send object to record, I dont want to update cell by cell with

    this.record.set("TestColumn", "TestValue");
  2. #2
    Reason for the above question:
    I have item insert/update in iframe window. Since there is a no possibility to use code behind with parent grid, I must use JS to do it.

    So, solution in JS code:

    var GridRowUpdate = function (rec) {
        parent.App.GridName.store.insert(0, rec);
        parent.App.GridName.getSelectionModel().select(parent.App.GridName.store.getById(rec.ID));
    }
    First command is to insert a row. Insert is done in position 0 but if grid is sorted, new records goes on right place.
    It is interesting to point out that same function can update record if record already exist.
    Second command is to select inserted row.

    That JS function is called with:

    Ext.Net.X.Js.Call("GridRowUpdate", Art)
    from code behind where "Art" is object of item. Just collected form field values.
    Last edited by SaleCar; Apr 27, 2015 at 6:22 PM.

Similar Threads

  1. Replies: 1
    Last Post: Apr 13, 2013, 1:31 AM
  2. Replies: 0
    Last Post: Oct 22, 2012, 9:55 AM
  3. Replies: 4
    Last Post: Oct 07, 2011, 10:49 AM
  4. [CLOSED] Insert Grid Record - Edit First Cell?
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 10, 2011, 11:01 AM
  5. [CLOSED] Insert Record into grid
    By sharif in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 08, 2010, 2:16 PM

Posting Permissions