Sorting enable for a limited number of columns - jqgrid

In a grid with 5 columns, I would like to have the possibility of sorting only for columns 2 and 4.
What is the correct demarch for implement this ?
- declare sortable to true for columns 2 and 4
- what else ?

Default value of sortable property is already true (see here). So you have to include
sortable: false
property in the definition of all columns in colModel with exception columns 2 and 4. If you have many columns, then it would be better to change defaults for colModel items:
cmTemplate: { sortable: false }
After that you should include sortable: true in columns 2 and 4. In the way you can change any other defaults for colModel. See the answer for more details.

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.

Always sort grouped rows alphabetically in AG Grid

I am using AG Grid Enterprise edition with unbalanced groups and I'm looking for a way to sort the rows inside the group always alphabetically, and not by the column sorting applied.
In the example below if the users sort by either sum(Val1) or sum(Val2) ASC/DESC in the state group I want the cities to be sorted alphabetically.
https://plnkr.co/edit/VMNY3wHMZ3DlpcJi?open=app%2Fapp.component.ts
I just took the default example from https://ag-grid.com/angular-data-grid/grouping-unbalanced-groups/ and made the columns sortable.
public defaultColDef: ColDef = {
flex: 1,
minWidth: 150,
resizable: true,
sortable: true
};

jqGrid. Grand Total with million rows from a REST

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

Is it possible to add custome condition in filters?

I want to add greater then and lessthen condition in below example. is it possible?
Be careful about the option columns of your Handsontable definition.
The option Filters already have conditions 'Greater than' & 'Lesser than' but they will be available only for 'numeric' data type.
If I take this example, regardless of the data type, the conditions won't be available.
Now if I add the columns option in this edited example :
columns: [
{type: 'text'},
{type: 'numeric'},
],
The conditions you need will became available for the 2nd column.
Check Filter By Condition in dropdown
Fiddle Link :
http://jsfiddle.net/kumarrishikesh12/wr7snuws/

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.

Resources