Handsontable afterChange event is triggered on rows that haven't been changed - handsontable

I have noticed that if I edit a row in a table containing a date the afterChanges event is triggered more than once, but it should only be triggered once because I have only added a row,

This fiddle with a simple afterChanges handler shows that each time you edit a date you get only one afterChanges event triggered.
Perhaps you are making changes to cell values inside your afterChanges event handler?
Calling setDataAtCell inside afterChanges will trigger another call to afterChanges. If you do - you need to check for source !== 'afterChange' inside you afterChanges event handler like in this fiddle.

Related

How to unselect any selected record in an infragistics XamDataGrid?

I have a XamDataGrid with XamComboEditor as its CellValuePresenter.
I have written a handler for XamComboEditor SelectionChanged event (XamComboSelectionChanged) that updates my collection as per selected item.
When I apply filter to the XamDataGrid from its header, it triggers XamComboSelectionChanged event handler somehow and the value from XamDataGrid.ActiveRecord gets updated due this event handler. I want to avoid this.
This problem does not occur if I don't click on any record. i.e. XamDataGrid.ActiveRecord is null.
If there is any way I can unselect the selected row my problem would be solved.
I have tried setting XamDataGrid.ActiveRecord = null in RecordFilterChanged event of XamDataGrid didn't work.
XamDataGrid.ActiveRecord.IsActive = false didn't work.
XamDataGrid.ActiveRecord.IsSelected = fals didn't work.
Also I tried to update dependency property but I can only set it to any other record only which still causes same issue:
xamDataGrid.SetValue(XamDataGrid.ActiveRecordProperty, xamDataGrid.Records[0]); -- can't set anything out of index here.
Please help
Thanks

Jqgrid Edit Form Change Event of Select doesnt fire when scrolling thorugh records

I have been following this example, http://www.ok-soft-gmbh.com/jqGrid/DependendSelects2.htm, as it is just what I need. I have got it working but it doesnt work when scrolling through records. If you bring up the form and scroll from a UK record to a US record, the list doesnt change. The onChange event only fires when the user selects from the select drop down.
Is there a way around this?
Thanks for your help.
James
My old demo uses 'change' event handler defined in the dataEvents property of the editoptions. In the dataEvents array one can define other event handlers.
You need just bind keyup to the column exactly like it's described in the answer. In the body of the event handler you can do the same actions as in the body of the 'change' event handler (you can place the code in a function and call it from the both handlers). In the way you should be able to solve the problem.
UPDATED: I updated the old answer and another one which was origin for the demo which you used. The new demo support the navigation buttons (the buttons to edit the 'next' or the 'previous' row) in the editing form.

jqGrid saveCell method returns nothing except gridelement. can i get true/false or can i pass a callback to saveCell?

I am using jqgrid 3.8. I have a grid which is having some editable columns.I also have an update button to save the grid contents on the server.
If user clicks on editable cell and changes the content and then clicks on update button, i am doing the following things.(after clicking on cell user directly clicks on update button)
first i am calling jqGrid 'savecell' method with iRow, iCol.
here the cell is being saved/ showing popup for validations.
but i want a callback to know whether cell is saved/not so that i can stop or continue my save functionality.
my sample code is like this
function updateGrid(){
// i have iRow, iCol references in beforeEditCell event as grideditRow, grideditCol.. these values r not getting modified nowhere else..
$(gridid).jqGrid('saveCell', grideditRow, grideditCol);
//logic to get grid data using getchangedcells and send ajax call to server.
var changedCells = $(gridid).jqGrid('getChangedCells', 'dirty');
}
how can i stop update logic after saveCell call if savecell is failed. saveCell is returning only jqgrid element.
is there any mechanism to get true/false from savecell or can i pass some callback to savecell?
There are afterSaveCell and errorCell events. One of the events will be called after saving the cell on the server. If you implement the corresponding event handler, you will be notified whether the saving of the new cell value was successful or not.

Subgrid updation in crm 2011

I am having a sub grid in the crm form 2011. When I add a new record, I want the count to be updated in the field i added in the header.
The problem is that when I add a new record I need to refresh the form otherwise, the count will not take the newly added record into consideration.
Is there any way I can refresh the grid soon after I add a record the count gets updated?
I use Jscript to count the records.
Assuming your JScript to count the subgrid's records exists in the parent form, it sounds like what you need to do is ensure this code is fired when the contents of the subgrid change.
There's an example of how to do this here - what you need to do is attach an event handler to the subgrid's refresh event. So, when the subgrid refreshes, your handler (in the parent form) is called, and can re-count the records at that time.

Fire "afteredit" after edit the entire row in ExtJS grid?

I have an ExtJS editor grid which has some columns inside. I want to modify data on a record and auto save data to DB. But I just need save data after I complete editing all cells at the current row. I've used the event "afteredit" but it fired the event right after one cell was changed.
How can I keep that event not to fire until I've completed modifying all cells? Or could you please suggest another way to do this, not use the "afteredit" event?
Thank you so much.
You might take a look at Ext.ux.grid.RowEditor. It has an afteredit event that fires when the row is done being edited.
You can find the working example at http://dev.sencha.com/deploy/dev/examples/grid/row-editor.html
Here is my question back: Do you edit all the cells in a row? A better solution would be to use a "save" button to send the updated data back to the server and save it into DB.
Now, if you insist that all cells at a row will be modified, you can do the following:
In afteredit event handler:
Get the record being edited (you can get it by event.record)
Check if all the fields have been modified in the record. This can be done by inspecting the public property modified.
If all the fields are modified, proceed with sending the updated record to server for saving into DB.
When edit event has been fired, you should check modified config to check whether all of grid columns have been modified or not. After modifying, you can send them to your back end.
I think in your case it would be easier to have a button that you click to save the grid. you could access all the modified records by calling grid.store.getModifiedRecords() and send that to your backend service and do a mass update instead of updating a single row at a time.
You could use the rowdeselect event on the selection model (assuming that you use a Ext.grid.RowSelectionModel. Inside the event handler you can check if the record has been modified and react accordingly.
var grid = // your grid
grid.getSelectionModel().on("rowdeselect", function(selModel, rowIndex, record) {
if (record.dirty) {
// record has been modified
}
});

Resources