sort the fixed data table on the click of a header - fixed-data-table

I have a fixed data table which is rendered in the order of the API response.
I want to sort the table on the click of an header primarily an 'id' in Ascending and Descending order
Is there a simple way to implement it from other than the example given in the docs

Related

How to persist the column order of the dataGridPro table in Material UI?

I am trying to persist the column order of the dataGridPro table in Material UI. As you know, we can simply allow all column reordering by dragging the header column and moving them left or right. But the column order would be initialized after the page reloading.
By default, columns are ordered according to the order of the columns array.
Should I store the updated array in the backend database or other storage? How can I implement this functionality and which choice would be preferable?
I am looking forward to your answer.
Expected behavior
Persist the column order after the page reloading or page navigation

How does firestore order documents

I have recently started a firestore database. I was wondering is there any order in which the documents are added? is it just in the order they are created in?
There is no inherent sort order in which documents are stored, but you can specify the sort order you want to retrieve them in through the API. The documentation also contains a full table on how data is sorted.
If you're asking about the Firestore console, that by default orders the documents on their IDs, but you can change that by clicking the filter button at the top of the list of document IDs.

how to refresh ui-grid before apply data sorting

I need to sorting an ui-grid table rows ascending and descending in base to one column selection. My problem is When I call to the api it only give me the last 100 results, so If I try to show the 100 littlest results I need to send new request to the api and refresh table data.
What is the best way to refresh the table data when user click on the sorting button and Before apply the sorting function?

groupdatamodel not taking in given order

The problem i am facing is that the data listed in list view is in ascending order in BB10. I have read from blackberry site that group datamodel will display data either in desc or asc order.I really want them to be displayed in list view in the order they are in database.
Please help me.
If you have an id field in your database, you could use it to sort your items.
But I guess you shouldn't be using a GroupDataModel if you don't want to group your data (if you don't sort it, how can you group?). What you need is probably an ArrayDataModel, or your own DataModel subclass.

Order data using values stored in another table

I've been using cakephp for a while, but have not learned all the ins and outs yet so I may be missing something simple. Or the problem may lie with my database structure. Either way, if anyone has any idea of what I'm doing wrong, please share.
Is there a way to order the data returned by cakephp's find using values stored in another table?
I am creating custom form fields on a per category basis, so when I choose a particular category to post in, custom fields will be added to my form. I have 3 tables: Posts, Fields, and Answers. The Posts table stores the basic static information for the post, such as id, category_id, title, and description. The Fields table stores the custom field data, such as category_id, field_label, field size, etc. The Answers table stores the values that are entered for particular fields, such as post_id, field_id, value.
I am trying to display the posts for a particular category, and create html table headers on the fly, using select fields, set by a column toggle in the fields table, and also select the answers associated with that particular field and post.
I am able to select all the data I want, and paginate everything just fine, but what I can't seem to figure out is how to order the data using one of the dynamic column values. For example, if I have year, make, and model as 3 custom fields, I would like to click the year column to sort my results by the year values, and if I click the make column, I would like to sort my results by the make values, etc.
I know how to order the results by a particular field inside the posts table, such as id or title, but is it possible to order using the custom fields? Am I setting up the database and/or something else wrong, and if not is there are particular cakephp method or sql command that I need to use in order to sort by the custom fields? I'm not really well versed in complex sql commands.
Thanks.
I'd suggest you pass the field name and sort direction in the URL (GET param). So when you have your table header link, form it so that it links to a URL as so:
http://somesite.com/pages/index/sort:customfield1/dir:asc
Then when you're grabbing the data from the db in your find() query, include the named parameters as the order parameter that can be sent to find.
You'll need to determine a default sorting column and direction. Maybe have that be selectable with a boolean field in the schema -- if there are no parameters sent to the action above, pull the field from your other table that has default set to true in the record.
To clarify: when a user visits a given action, first you'll pull the custom fields from the other table. Then using those fields (either the default as mentioned above, or the named params passed in the URL) form the query for the actual data, using the order parameter.

Resources