How to prevent Kendo UI Grid from rebinding many times when updating ViewModels - mvvm

When you bind to a Kendo UI Grid with MVVM, databound will fire once and all is well. If you need to update that data after the fact, every time you change one piece of data on any viewmodel (or child viewmodel), the entire grid re-databinds. Thus, if you had some cell in the grid that is bound to a template and you have to change 2 or 3 properties on the viewmodel from some external ajax source, Databound will fire 2 or 3 times for each model that is changed, causing the entire viewable area to rebind. How can we update lots of data at once and only have databound fire once?

How exactly you rebind the Grid? Basically if you change some of the models like this:
dataItem.set('SomeField','new value');
dataItem.set('someOtherField','other value');
This way the Grid will be indeed bound two times because of the MVVM. The change event is triggered each time you call set.
However if you update the values like this:
dataItem.SomeField='new value';
dataItem.someOtherField= 'other value';
The Grid wont react to the change and wont rebind re-read the values from the models you can force the Grid to do it through the refresh method.
$('#gridName').data().kendoGrid.refresh()

I'm not sure if there is some way to temporarily tell the grid to stop listening to events and then at the end, re-sync once. If there is, please give that answer here! Otherwise, what I did instead is I didn't go through .set() for each item. Instead, I updated the data for all the rows by setting the data directly to the property. Then when I got to the very last row I was updating, I called .set() on the last property that needed to be updated. This will cause databound to fire only once and the entire grid will refresh itself with all the data that was changed. If you don't do it this way, then the more rows displayed on the page, the longer it takes to process. (It could take 20+ seconds before the user can do anything again.)

It looks like the dataBinding event is where you can prevent a rebind on the grid.
Telerik Online Docs

Related

Does React Data Grid have "Read Only Deletion" in addition to "Read Only Edit"?

React Data Grid has a Read Only Edit feature that allows you to turn the grid into something like a "controlled" component:
Use this if you want to manage the grid data state externally, such as in a Redux store.
It works well for edits, but I can't find a way to handle cell value deletions in a similar way. When you press Del while focusing on a table cell, the deletion seems to happen in-place. There doesn't seem to be a "cellDeletionRequest" which complements the existing "cellEditRequest".
Consider this example from the docs. Before completing an edit:
After completing it:
However, deleting a cell doesn't seem to trigger any deletion request, the cell's value is updated in-place, making it difficult to externalize the grid's state:
Is there a workaround for this apparent limitation?
Unfortunately, ag-grid doesn't seem to have a function like cellDeleteRequest
or detecting cell deletions yet. But you could use onCellValueChange to detect general events of a changing cell value including cell deletion.
Have read of Column Events for more detail about onCellValueChange
Hope this would be helpful!

ag-Grid increment cell value after button click

I'm working with ag-grid I have a table that looks like the one provided HERE. In my own project, I am using an external api that will receive a real item. I need to update the Received Quantity after the done. Unfortunately, the api doesn't return anything other an a status code. So I can't do something like remove the row and a new row and this particular endpoint is also throttled heavily so I can't just refetch the list over and over to update it (which probably isn't a good idea anyway).
My plan was to just take the current value in Received Quantity and increment the cell myself. I can't seem to get it right and I just out of ideas of how I can possibly do that (I know it's probably simple by brain is just fried).
I'd really appreciate it if anything who's done this can help me out.
I ended up figuring this one out after a couple days not thinking about it. So I'll answer my own question for anyone who needs to know in the future.
I was trying to "edit" the data when I really needed to "update" it.
Essentially, every row in your grid will have a RowNode. You can access this node from the params of the row . Every is RowNode is indexed and has a setDataValue function which you can use to update entire rows or single cells. Click the update link above to reach the relevant documentation.

Flutter Paginated Data Table: Filter RowData

I have been using the PaginatedDataTable widget in flutter and am looking to add a search bar to filter down the rows based on the input
However there is no clear way to do this; most tutorials only show sorting the columns.
When I modify the RowData object that's passed into the source input of the table nothing happens.
Does anyone have any tips on what I'm missing?
Many thanks in advance.
Perhaps you are missing a notifyListeners after changing the data source?
Call this method whenever the object changes, to notify any clients the object may have changed. Listeners that are added during this iteration will not be visited. Listeners that are removed during this iteration will not be visited after they are removed.

How to refresh form when I open?

I have a CheckBox in my TabPage on my Form, if I select the checkBox, the value is saved in a Table field (present in my FormDataSource: ParametersTable).
I want to refresh the form when I enter in TabPage, just Like pressing F5.
Is it possible?
There is a great article about different methods of refreshing the form's data here. Here are the basic outline:
1. Refresh
This method basically refreshes the data displayed in the form controls with whatever is stored in the form cache for that particular datasource record. Calling refresh() method will NOT reread the record from the database. So if changes happened to the record in another process, these will not be shown after executing refresh().
2. Reread
Calling reread() will query the database and re-read the current record contents into the datasource form cache. This will not display the changes on the form until a redraw of the grid contents happens (for example, when you navigate away from the row or re-open the form).
You should not use it to refresh the form data if you have through code added or removed records.
3. Research
Calling research() will rerun the existing form query against the database, therefore updating the list with new/removed records as well as updating all existing rows. This will honor any existing filters and sorting on the form, that were set by the user.
4. ExecuteQuery
Calling executeQuery() will also rerun the query and update/add/delete the rows in the grid. ExecuteQuery should be used if you have modified the query in your code and need to refresh the form to display the data based on the updated query.
I strongly recommand that you read the article. Try to use some of the methods above or some combinations of them.
Start with research() method, it might solve your problem:
formDataSource.research();

Refresh the Parent form of "Call_form" after Child form is closed in Oracle 10g

What I need is:
what trigger to use and where to put it.
I will give you an example of what I am doing.
I have a Contract form that is fully editable except the contract financial areas, which is read only. I want the user to press a button called, “change rates” and that will have a trigger “When-Button-Pressed” and call_form(UpdateFinancials);.
Now, in this screen, I have the user change the financial information such as increase the contract from 50k to 100k. Then the user saves and exits. This will then close the child form "UpdateFinancials" and show the parent form "ContractForm". The problem is, it still has all the old information on it. I need the information in the form to refresh when it gets back from the child form of the Call_Form function.
In the WHEN-BUTTON-PRESSED trigger, before you issue the CALL_FORM, set a variable (e.g. a hidden item or a global variable) to some value, e.g. 'CALLED_THE_FORM'.
In the WHEN-WINDOW-ACTIVATED trigger, test the variable, if it's ='CALLED_THE_FORM', reset the variable (e.g. to NULL), and run whatever code you want to run when the user returns from the form (e.g. execute query or whatever).
Alternatively, just execute query from the WHEN-WINDOW-ACTIVATED trigger - if you want the refresh to happen every time the user returns to the form. But personally I prefer to only refresh when I believe it is absolutely required.