jqGrid. Grand Total with million rows from a REST - jqgrid

How to show Grand Total with million rows from a REST?
Documentation has the example when all data is loading once with option loadonce: true but that is a very small number of rows. How can I attain the same with partial data loading?

You can calculate the total of the column field on the server and transport it using userdata again with options userDataOnFooter
$("#grid").jqGrid({
...
footer : true,
userDataOnFooter: true,
...
});
See the docs for these options and the demo here

Related

Spotfire - KPI of multiple Boolean columns that can limit data

In the data I have there are multiple Boolean columns that categorise each row, for example:
Object
Fruit
Yellow
Round
Chair
FALSE
FALSE
FALSE
Banana
TRUE
TRUE
FALSE
Apple
TRUE
FALSE
TRUE
Ball
FALSE
FALSE
TRUE
I am trying to make a KPI chart that would go alongside a table of this data in which it would have 'Fruit', 'Yellow', & 'Round' as categories and a count of how many are true, so that when you click on them it will mark and limit the data in the table. In this example 'Fruit' would have a count value of 2, 'Yellow' 1, and 'Round' 2.
How can I make a single KPI chart look at multiple columns and count their True values? I tried making a second data table to unpivot the columns into rows and have their count, which works, but then I am unsure as to how to make a relation between the two table such that I can mark and limit the original data table?
Please let me know if you require any information. I am using Spotfire 10.10, and this is how the data is presented to me, I cannot change it.

jquery datatable: Initial sorting by aaSorting for multiple columns not working for ajax data

I have two data tables in my project. First one is taking data from an array in my hand,
data table #1:
$('#table1').dataTable({
"sPaginationType": "full_numbers",
"iDisplayLength": 25,
"aaSorting": [[7,'desc'],[2,'desc']],
"bStateSave": true
});
In above table I got the result sorted as expected. But for my second table, which uses an ajax request for data, is not sorted as expected,
data table #2
$('#table2').dataTable({
processing: true,
serverSide: true,
ajax: 'a valid url',
"aaSorting": [[3,'asc'],[0,'desc']],
"bStateSave": false,
"iDisplayLength": 25
});
I got the column with index 3 sorted but column with index 0 is not sorted for the same values of column 3. Do anyone is facing this kind of issue? Any help or suggestions invited.
If you use aDataSort instead of aaSorting , you can tell a column that it should do a multi-column sort rather than just by itself. - as said over here by datatable site admin allan.
For more detail about aDataSort, go at datatable

DataTable incredibely slow with IE8

I use Datatable on a table, I load the data from a JS array (so it is server-sided). In order to load a list of 350 rows - each rows of 10 column - IE8 requires more than 10s where filter and sorting are disabled.
https://datatables.net/faqs/index says that it can handles thousend of rows.
$("#table").DataTable({
"data" : data,
"processing" : true,
"filter": false,
"orderClasses": false,
"ordering": false,
"deferRender" : true,
"columns": columns,
});
(data is my list of rows and columns the columns description).
I understood that the slowness is coming from the initialization of the JS array that I pass to construct the table.
I used a PHP script and iterated over each row / column that I wanted like:
data[$row][$col] = 'xxx';
....
The only way I found to make it work really faster is to really build the js array in one pass like:
var data = [
<?php foreach($rows as $row)?>
{ <?php foreach($cols as $n=>$col?>
'<?php echo $n?>': '<?php echo $col?>',
];
This way for a 1 000 lines tables I pass from 15s to 2s with sorting and filtering activated.
Carreful: when IE8 sees an array like
[{'coucou': 'hi'},]
Then it builds an array:
[{'coucou': 'hi'}, undefined]
That datatable doesn't like

jqGrid - Disable Reordering of Specific Columns

I have a jqGrid with the grid-level 'sortable' option enabled. This lets me drag columns around to reorder them, which is great. But I want to prevent users from doing this with one specific column, leaving the others unaffected. Is this possible?
I find your question very interesting and so I made the corresponding demo which demonstrate the solution. On the demo is the first column "Date" unsortable.
I recommend you to read two other old answers on the close subject: this and this. My suggesting are based on the same idea.
There are internal jqGrid method sortableColumns which will be used internally if one uses sortable: true option of jqGrid. The sortableColumns method uses jQuery Sortable for the implementation and initializes items options of the grid having id="list" to the value ">th:not(:has(#jqgh_list_cb,#jqgh_list_rn,#jqgh_list_subgrid),:hidden)". It makes the columns "cb", "rn" and "subgrid" unsortable. The columns could be inserted in the grid if you use jqGrid options multiselect: true, rownumbers: true or subGrid: true. In the same way is you have the column with name: "invdate" then the corresponding id of the column element will be jqgh_list_invdate. So one can use the option sortable as the following
sortable: {
options: {
items: ">th:not(:has(#jqgh_list_cb,#jqgh_list_invdate,#jqgh_list_rn,#jqgh_list_subgrid),:hidden)"
}
}
to make the "invdate" column unsortable.

jqGrid footer filter text

Is there a way where in i can display something like: "Filtered 20 records out of 30" where 30 is the total count of records in my jqGrid footer???
You need to set de property viewrecords:true in the jqgrid. Check de documentation here.
"viewrecords:Defines whether we want to display the number of total records from the query in the pager bar"

Resources