In trNgGrid, how to get filtered data for export, or get current filter's value - angularjs

I am using angular's trNgGrid library to display a table of data and trying to export data. On some occasions I want to export the filtered data.
My question is:
How to get the data records filtered by the active filter or get the active filter's value.
Thanks.

Is this example helping? See Grid Configuration - http://moonstorm.github.io/trNgGrid/release/#/GlobalOptions
Using filtered-items="myGridFilteredItems" attribute you should be able to access filtered array.

Related

I want to access filter data while searching in Material Table React - how to access or is there any method to access or triggered while searching

i am trying to update the data according to search filter in material table, i didn't find any method or param by which i access the data updated on search filter, i can call an api and provide search filter but it may slow down the query so i want to do it on frontend side.
i have tried the method above mentioned handleSearchChange which only give the search query nothing else, if i can get access the data of updated after searching in search field then i can do what i want
I have found an answer for the above query I have posted, the simple way to use the useRef in material table, by which you can access the current data of your table displaying.
tableRef={tableRef}
to access the data you can use
tableRef?.current?.state.data

Pull data into filter or new field

I need to keep updating a filter by adding landing page URLs to it - but those URLs already exist in Google Sheets (and are updated there first).
Is there a way to make the filter pull directly from the sheet?
Thanks,
Steve
How about using the sheet as a halfway house for your main data source, and using formulas to filter the data there before it even reaches GDS?

Search form model(s)

I have to design a search form and display the results. I am having some difficulties finalizing the models/collections to be used.
I have a few fields which acts as filters. These fields are select boxes where multiple items can be selected. After an item has been selected from a field, I need to call the API which will return a list of results with this filter and also all the remaining filter options for the other fields based on the first filter.
What I am confused is how should I go about this. Should every select box be a model? Because the options for each select box will be changing.
About the results,
I am thinking that results should be a collection. But given that there is only one API endpoint here, I am confused which model should hold the url.
Since your API is actually returning a collection of results, I'd keep the filter parameters in a model, and while submitting search request, create the collection URL dynamically based on the filter model attributes.
You can go the other way, send the request from model itself, then in parse set results from response to the collection and remove it from model, but it seems more hacky than dynamically creating collection URL

Extjs - How to get displayfields from itemselector?

The Extjs Itemselector component has methods like getValue, getSubmitData, getSubmitValue which will return the keys of the records that are selected.
I am looking for a better way than taking the keys of the records selected from the component and fetching for the record from the store by searching the store in a sequential fashion. This is a very time expensive solution which is not working well for me since the itemselector has a large number of records.
Question : is there a way to retrieve the displayed string/value (in the selected part of the itemselector) along with the keys directly from the component and not as above ?
thanks
Nohsib
This works in my code to get an array of all the records which you can then get the values from, it may not work in yours if you have a different version of Extjs:
itemSelectorField.toField.store.getRange();
Oh and if you want the display values as a string list:
itemSelectorField.toField.store.getRange().collect("display_value_propery_name").join(",");

angularjs ng-grid computed column

I'm trying to emulate a spreadsheet using AngularJS and ng-grid. My needs are simple but I cannot find anything anywhere that will help me fix my code.
I have a simple table of scores and in the last column I need a "Total Score" column.
You can see my code at this plunk.
My problem is that though I was able to get the total in each row on document.load, I cannot make the "Total" column update whenever any of the scores are changed.
Or alternatively, you could add the getTotal() function directly to the model object:
http://plnkr.co/edit/LhlK1C?p=preview
I prefer solutions where I don't have to work with $watch(), but it depends if you want the total to be stored in your model or only need it for display.
You could watch for changes to the 'original_data' object and recreate the process_data object every time updates.
http://plnkr.co/edit/c4iynItnznKNRoFgeuio?p=preview

Resources