Sunday, 6 November 2016

Editable Grid Events in Dynamics 365

Editable Grid support the below JavaScript events for home grid and sub-grids
  • OnRecordSelect
  • OnSave
  • OnChange
OnRecordSelect
  • Event triggers when a single row is selected in the editable grid.
  • This event won’t trigger if a user selects different cells in the same row or selects multiple rows.
// Register this event on onRecordSelect event
function gridRowSelect() {
    // Read selected rows from editable sub grid
    var selectedRows = Xrm.Page.getControl("subGridAccounts").getGrid().getSelectedRows();
}

OnChange
  • The OnChange event occurs when a value is changed in a cell in the editable grid and the cell loses focus.
  • This event can also occur when an attribute value is updated using the setValue method.
OnSave
The OnSave event occurs before sending the updated information to the server, and when any of the following occurs
  • There is a change in the record selection.
  • The user explicitly triggers a save operation using the editable grid’s save button.
  • The user applies a sort, filter, group, pagination, or navigation operation from the editable grid while there are pending changes

Some important points to consider for the OnSave event:
  • If a user edits multiple columns of the same record in sequence, the OnSave event will only be fired once to ensure optimal performance and form behavior compatibility.
  • Editable grid and the parent form have separate save buttons. Clicking the save button in one will not save changes in the other.
  • Editable grid does not save pending changes when navigation operations are performed outside of its context. If the control has unsaved data, that data may be lost. Consequently, the OnSave event may not fire. For example, this could happen when navigating to a different record using a form lookup field or through the ribbon.
  • Pressing the refresh button in the editable grid causes it to discard any pending changes, and the OnSave event won't be fired.
  • Editable grid control does not implement an auto-save timer.
  • Editable grid suppresses duplicate detection rules.

Hope this helps.
--
Happy CRM'ing

Gopinath

1 comment:

  1. Hello! Actually I've found something about Editable Grid Events and how to use it. I am just a beginner and have tried only microsoft dynamic ax system, which is more easy. So now I'm learning some features of this new one :) Thank you so much for sharing!

    ReplyDelete