I am using jqgrid, with filter toolbar(column) option...The total data is around 10,000...So it seems to be some delay in initial loading as the config is set to loadonce:true;
Any way to implement the filter column feature with loadonce:false ?
Because the data loading delay is okay with loadonce:false. If I get a chance to add column filter with loadonce:false, this will work perfectly...
If you has about 10,000 rows it is of course better to implement server side data paging, sorting and filtering. I recommend you to use filterToolbar with the parameter stringResult:true if you not already use it. In the case jqGrid will send to the server filters parameter in the same format like advanced searching as do. So you will need implement on the server side the method which use following input parameter from jqGrid:
sidx and sord parameters define the sort order of the data. The informations specify ORDER BY in the corresponding SELECT statement.
if _search parameter is true, then the next parameter filters gives additional information which construct the WHERE part of the corresponding SELECT statement.
page and rows parameters define which page of the data previously sorted and filtered should be returned.
The exact implementation is depend on the language and technology which you use on the server and of course which database server and which interface to the database you use.
Related
i'm implementing a web page that shows certain rows fetched from a database.
At loading, i make an AJAX request to fetch the rows in a certain range of time(the initial call will take today's rows), and save them in a global variable(e.g "rows").
I have two text field to set the starting and the ending point of my research, and every time i change the value of those text-fields, i make another call to the db to get the new data and update global "rows" variable.
My question is: if i have different text-field filters and sort options that apply filters and sort to the fetched rows, should i make another request to the db(with the selected filters/sort) and let the db handles the filter/sort, or should i apply the filters/sort directly the global "rows" variable?
Of course i think the db filtering and sorting would be more efficient, but the number of rows shouldn't be more than 100, max 200 rows, and i was wondering if it would be worth it to make another AJAX request just for filter the result.
Thank you very much in advance.
have you try with datatables server side??
https://datatables.net/examples/data_sources/server_side.html
I think is a good options for you and very easy to implement
I have a grid where the user can select records via checkbox in front of every record. Now I have a requirement to sort the records based on their selection, so that all selected records should be placed top, followed by the not selected ones.
Is there any standard function to achieve this? As an alternative I thought of saving the selection state as an attribute on every record and sort based on the attribute.
The code for the column is:
gridRealmDt.setSelectionType(SelectionStyle.SIMPLE);
gridRealmDt.setSelectionAppearance(SelectionAppearance.CHECKBOX);
I try to describe the code I use as the affected code is deeply nested in our own framework classes.
gridRealmDt is a subclass of smartgwt ListGrid. In my Dialog a create an instance of the grid which creates an instance of a database bound datasource. When the dialog is loaded the records are fetched from the database and after that a registered an dataArrivedHandler where I select the records which match records from another table.
I tried to place the selection attribute in an extra field and use that for sortig before my other sort criteria, but this does not work. Here is the code for the field I am using.
ListGridField txtSelected = new ListGridField(SELECTED, "");
txtSelected.setHidden(true);
txtSelected.setSortByDisplayField(true);
txtSelected.setCanSortClientOnly(true);
When I do not set the canSortClientOnly property the order by is sent to my database resulting in an error, as the table does not contain that field, so I set the property. Now I get following error
Removing field from the sort Specifier array because it specifies canSort Client Only: true and all data is not yet client-side.
I also tried to use a sortNormilizer on the Name field which is my main sort criteria, but the normalizer is called before the selection value is set to the record.
record.setAttribute(CARealmDS.SELECTED,selected ? "a" : "b");
I also cannnot find a way to call the normalizer when selection changes.
Currently we are using Smart GWT Version 6.0p.
I don't think there is any standard function. Just use grid store update. Place checked items first.
I would like to know if there is a way to add extra parameters to the sort call. When I click on a jQGrid column in order to sort (asc or desc) a row, I would like to know if there is a way to add extra parameters in order to be able to customize my order on server side basing in passed parameters. Because, every time I click to order by a column, when I reach the server I dont know if the call is from a sort event or from a load event, and I have to know it to make diferents querys.
thanks
You can use the onSortCol event to modify the postdata of the grid to send an additional flag
Alternatively, you know the default sort column and sort order that you set in the grid object. You could just check in the backend to see if the sidx and sort parameters are different from the defaults.
I have 100,000 records right now (will grow in future). I have JSON api call (remote URL, however, within same server) to get those records. If I use KendoUI with paging turned on (say 50 per page), will KendoUI datasource going to fetch all those records and bring them into client and apply paging? Or is it something I need to pass to the server (page size) to be able to only get only needed data for display? If I need to pass, do I have to write custom data source query methods?
Same question goes for using filter input boxes in toolbar within KendoUI.
There are two (efficient) ways of loading that amount of data:
Setting serverPaging to true in the DataSourcedefinition.
Using serverPaging plyst (as #bobosov534 and #gitsitgo suggests) virtual scrolling.
In the both you receive in the server tow parameters: top indicating the number of records to retrieve (what you have defined as pageSize) and skip for the number of records to ignore (no skip means the first top records).
The difference is that int the first you see a pagination bar in the bottom of the grid and in the second you see additional records as you scroll down.
In DataSource.serverPaging you find detailed information on the fields sent to the server for managing pagination.
Can anyone please tell me how to sort integers/numbers in JQ grid.
the regular sorting gives a distorted order.
Hi i got it all done when i use loadonce=true and sorttype = 'int'. But i cant use loadonce, since i need to reload the grid several times for my purpose.
Can anyone say how to do it without using loadonce??
Thanks,
Devan
If you use datatype:'json' or datatype:'xml', then the server is responsible for the data sorting. The sidx and the sord parameters which will be send as the part of request to the server describes which sorting should use the server.
If you want to implement client side sorting and paging of data you can use loadonce:true jqGrid parameter. In the case you should define sorttype property (having default value 'text') which describes the data type from the column. After the first data loading the datatype of the jqGrid will be automatically changed to 'local' and the sorting, paging and filtering/searching of data will be implemented locally by jqGrid itself.