This topic contains 5 replies, has 2 voices, and was last updated by Hiro 9 years, 6 months ago.
- Topic
Is it possible to get the response data from “rowClicked” event so that I can set field values to a form?
Currently I have settings like this in datagrid.yml:
12345678910111213141516properties:id: ~update_link:type: urlroute: acme_api_get_itemparams: [ id ]actions:update:type: ajaxacl_resource: acme_updatelabel: acme.datagrid.updateicon: editlink: update_linkrowAction: trueAnd I can see FireBug sends the request and gets the response like:
123{"id":1234,"type":"blabla","code":"abcd","quantity":"1.00","price":100}Currently the setting in datagrid.yml is used only to show the pointer icon on hovering the row because there seems to be no way to catch the event unless you bind the extra callback and send the request by yourself to get the data as follows:
1234567891011121314$('#grid-acme-grid').data('datagrid').body.on('rowClicked',function(grid, event) {// Say, ID is displayed at the first columnvar url = '/api/rest/latest/acme-get/' + grid.cells[0].$el.html() + '.json';// Sending the AJAX request so that I can get the data which is redundant$.get(url, function(result) {// Set values to the form with "result"});},'acme');Is there a way to define the callback when the AJAX request happened originally?
The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.