Consider this: I have a datasource that is an array that lists shirts. The shirt will have a field for color, style and price. I want to filter the grid to show only Red shirts and my grid is set up to only show 10 shirt per page. The number of Red shirts is over 100 and I want to increase the price by 10%. If I didn't care about the filtering on the datagrid I would simply update my array. But How do I know what is the filter on the DataGrid? Also if I didn't have pagination couldn't I just loop the visible rows? What's the easiest way to do this with code?
Thanks.
Hi William,
Greetings from Syncfusion support.
Based on your query, you want to get the filtered data from the grid. Your requirement can be achieved by using the `getFilteredRecords` method of the EJ2 Grid.
Please refer the below code example.
|
<ejs-button id="select" cssClass="e-flat" @click.native="select" >Filtered Records</ejs-button >
-----------------------------
select: function (args) { var gridObj = this.$refs.grid; let filteredRecords = gridObj.getFilteredRecords(); // get the filtered records. console.log(filteredRecords); // to alert the selected records count. },
|
Sample: https://codesandbox.io/s/vue-template-forked-5001v6
Please get back to us for further details.
Regards,
Joseph I.
I finally got around to implementing this into my code and I could not get it to work. So I went back to your sandbox and I don't think it works either. When I click the Filtered Button the Console shows an empty array. I added writing the array length and that was always 0.
Another question is that I assume that the filtered array is making a totally separate copy? So any changes to the fields in the filtered copy will not show back up in the original data source array unless I filter the original datasouce with a unique ID and update that value also? So if I change the filter the updates will not carry over to the new filtered array unless they were changed in the original datasource-- right?
Not sure if this helps
TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
at Function.invokeGetter (<anonymous>:3:28)
at _callee$ (webpack-internal:///./node_modules/@quasar/app/lib/webpack/loader.transform-quasar-imports.js!./node_modules/babel-loader/lib/index.js?!./node_modules/@quasar/app/lib/webpack/loader.auto-import-client.js?kebab!./node_modules/vue-loader/lib/index.js?!./src/eval/e_publication_search_eval.vue?vue&type=script&lang=js&:990:17)
at tryCatch (webpack-internal:///./node_modules/regenerator-runtime/runtime.js:63:40)
at Generator.invoke [as _invoke] (webpack-internal:///./node_modules/regenerator-runtime/runtime.js:293:22)
at Generator.eval [as next] (webpack-internal:///./node_modules/regenerator-runtime/runtime.js:118:21)
at asyncGeneratorStep (webpack-internal:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js:7:24)
at _next (webpack-internal:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js:29:9)
at eval (webpack-internal:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js:36:7)
at new Promise (<anonymous>)
at eval (webpack-internal:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:12)
Hi William,
Currently we are validating the query with your share information, and we will update you the details on or before 12th July 2022. Until then we appreciate your patience.
Rajapandi R
Hi
Has there been any update on this issue?
Hi William,
Thanks for your patience.
Based on your query,
you want to get the filtered data from the grid. We were able to get the values
in the console window in the sample provided in the previous update. We have attached
the video of the same below. Please refer the below video.
Video: https://www.syncfusion.com/downloads/support/directtrac/general/ze/UNTITL~2-2080717
If this is not the issue you are facing, Please share video demonstrating the issue you are experiencing.
Please get back to us for further details.
Regards,
Joseph I.