How can i delete empty row in Ag-grid react - reactjs

I am using ag-grid enterprise in my project where i am inserting data into the grid. Once the editing of data is completed i am pressing submit button to save the entries in the backend. Before saving there are some validations which i am performing by passing gridApi to the method and there gridApi.foreEachNode i am validating the data. I have a new scenario where if all the cells of the row is empty. The row should be deleted so that user should not have to delete every empty row before submitting. how can i delete the row node inside foreEachNode?

I recommend that build up an array of row ids for the empty rows as you iterate through forEachNode, and then once you are done iterating, use the ids from the array to delete the rows.
However, I'd like to recommend an entirely different approach...
That is, don't treat the grid as the "source of truth" for your data.
Rather, keep a data model in your application, and use the grid just as a visual component (though a complex one), that represents the data in your model.
React is particularly suited for this, as you can use, e.g. Redux to represent your model and provide operations on it.
In this scenario, you would do these operations on your model, and then update the grid with the new value of your model. And your model would then be in a good state to send to your back-end.

Related

Better Way to Deal with Data from Database and Lists

I have TextField and onChange function it filters ListView, so is it better get whole item from table and save them in list then when change text filter that list or open stream get data from table every single change in search TextField?
I have lists in my app with elements, is it preferable when I go to another page or when I don't use the items, clear them every time or it is ok, it doesn't affect the app?

Add/ Update / delete over large collection in angular application performance issue

I have a angular page which shows 1000 of nested record (parent- child up to n-level) and further user can add/edit/delete the record from UI at any location. Each row contains a button to add row above/below, based on that new row is created. This UI has also drag and drop functionality over each row so if any row is draged over another then parent child rows created. For this we have a json collection in nested way and in UI we have created a directive which is called recursively to show the nested record using ng-repeat.
We are facing performance issue here, if user try to add a new row at any specific point we are adding a new blank row in json data on specified index and based on this blank row a blank form is shown which renders very slowly.
Functionality is working but whenever a new add/update/deleted happens over row then it stuck and takes time to re-render the UI.
I cannot implement pagination here to restrict rows as user can create parent child relation by dragging over any row so all record should be shown.
Any one can suggest if other way around for this performance issue?

ADF- Updating Row

We're trying to implement a very basic functionality in ADF 11g using Jdev(11.1.1.7). We have one table in database which is exposed to the UI layer using ADF BC.
The requirement is to update a table when user selects one of the row. It will open a popup and then user can update the value in that dialog box. This works well but along with the current row, ADF framework is also updating the first row with the previous value of the update.
To update a row, we're using the standard commit button from the data control and then overidiing the DoDml method in EO to update additional fields.
Can someone share the details why this happening with each update and any solution for this?
Thanks,
LG
First, remove the selectedRowKey value from the table properties otherwise this will always select first row.
After the commit refresh the page or relevant component to load updated data to UI.
If you are updating additional fields using doDML make sure to commit the data and refresh UI to load updated data.
Commit is transaction level, if the Status of EO row is changed that row will participate in transaction. Either you need to change the status of other row to un-modify or you can override beforeCommit in VOImpl .
Thank you,
TR

React - Data tables with React

I would like to use one of the many table/data-grid components available to render a table. However, I am struggling to choose one as I have very specific requirements and I'm not sure if they are supported by them.
Ok so ideally I would like the table to initialise with only column headers (which are populated by data from a database). I would then like to be able to add a row (by clicking on a button), and be able to enter data into the cells and then save the data in that row to my database. The column headers are generated by form but there can feasibly be any number of them. Most of the examples for the various components seem to expect you to already know what your data is before you render the table. But this will not be the case for me.
I was considering Griddle but they don't have an editable cell option yet (it's only part of the roadmap) so unless I create my own custom function, I think that that is out for now.
I was just hoping for some guidance is choosing the best component for what I need!
Thanks for your time

Oracle ADF: How to filter out rows in RichTable?

I have following requirement.
Display data in a table
Clicking on checkbox filter out currently displayed rows by some condition
Clicking on checkbox once again return data appearance to it's previous state
To achieve this I've ovverided method rowQualifies in my ViewObject which is simple SQL based view object to apply my custom filter logic.
When user clicks on checkbox I refresh view object data to apply filter
viewObject.setDoFiltering(true);
viewObject.setQueryMode(ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
viewObject.executeQuery();
It works perfectly, data set updates without interacting with database and my custom filter logic applies as well.
But when I need to cancel filter it wouldn't work because iterator doesn't contain anymore previous rows, and I can only load them from database but it means that I can lose my changes already made to view object rows.
So, when I do
viewObject.setDoFiltering(false);
viewObject.setQueryMode(ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
viewObject.executeQuery();
It will return me those rows that were displayed previous time.
If I do
viewObject.setDoFiltering(true);
viewObject.setQueryMode(ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES);
viewObject.executeQuery();
It will return me all rows, but I will lost my changes already made to view object rows.
My questions is how to avoid it? Maybe there is another way of doing this? Maybe it is possible to do something with RichTable to tell it how to filter rows in memory.
Any advices are warmly appricated!
I believe this can be done using ViewCriteria, to filter means to apply a ViewCriteria, and then disable it to view all your data

Resources