Is it possible to add custome condition in filters? - handsontable

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/

Related

How to Select multiple related columns in add calculated fields in Quicksight parameter using ifelse?

I have a parameter 'type' in a table and it can have multiple values as follows -
human
chimpanzee
orangutan
I have 3 columns related to each type in the table -
human_avg_height, human_avg_weight, human_avg_lifespan
chimpanzee_avg_height, chimpanzee_avg_weight, chimpanzee_avg_lifespan
orangutan_avg_height, orangutan_avg_weight, orangutan_avg_lifespan
So if i select the type as human, the quicksight dashboard should only display the three columns -
human_avg_height, human_avg_weight, human_avg_lifespan
and should not display the following columns -
chimpanzee_avg_height, chimpanzee_avg_weight, chimpanzee_avg_lifespan
orangutan_avg_height, orangutan_avg_weight, orangutan_avg_lifespan
I created the parameter type and in the add calculated fields I am trying to use ifelse to select the columns based on the parameter selected as follows -
ifelse(${type}='human',{human_avg_height}, {human_avg_weight}, {human_avg_lifespan},{function})
I also tried -
ifelse(${type}='human',{{human_avg_height}, {human_avg_weight}, {human_avg_lifespan},{function}})
And -
ifelse(${type}='human',{human_avg_height, human_avg_weight, human_avg_lifespan},{function}})
But none of it is working. What am i doing wrong ?
One way to do this would be to use three different calculated fields, one for all the heights, one for weights and one for lifespan. The heights one would look like this:
ifelse(
${type}='human',{human_avg_height}, ifelse(
${type}='chimpanzee', { chimpanzee_avg_height}, ifelse(
${type}='orangutan',{ orangutan_avg_height},
NULL
)))
Make another calculated field for weights and lifespan and then add these calculated fields to your table, and filter by type.
To make it clear to the viewer what data is present, edit the Title of the visual to include the type:
${type} Data
You have to create one calculated field for each measure using the ifelse with the type to choose the correct vale, but is not necessary to create inner ifelse as skabo did, the if else syntax is ifelse(if, then [, if, then ...], else) so you can define the calculated fields as follows:
avg_height = ifelse(${type}='human', {human_avg_height}, ${type}='chimpanzee', {chimpanzee_avg_height},${type}='orangutan', {orangutan_avg_height}, NULL)
avg_weight = ifelse(${type}='human', {human_avg_weight}, ${type}='chimpanzee', {chimpanzee_avg_weight},${type}='orangutan', {orangutan_avg_weight}, NULL)
avg_lifespan = ifelse(${type}='human', {human_avg_lifespan}, ${type}='chimpanzee', {chimpanzee_avg_lifespan},${type}='orangutan', {orangutan_avg_lifespan}, NULL)
Then use those calculated fields in your visuals.

How to add left-side dropdown to choose the operator

I try to add left-side dropdown in filter.DateRange, but i don't know how to do it
I would like to user have possibilty to choose range or single date with '<' , '>' etc in one column.
I'm the author of Angular-Slickgrid
The left-side dropdown you're talking about is only available for Compound Filters and the Date Range is not a Compound Filter. There is no need and no use case for this Filter to be a Compound Filter, I will not add such feature. You can however set the Operator to be inclusive (>= date1 && <= date2) or exclusive (> date1 && < date2) in your column definition. The Range Filters versus Compound Filters are very different, you cannot add all operators of a Compound Filter into a Range Filter (<, <=, <>, >, >=) that just doesn't make any sense, what make sense on a range is to know if it's inclusive/exclusive and that is available just not dynamically.
this.columnDefinitions = [
{
id: 'finish', name: 'Finish', field: 'finish',
formatter: Formatters.dateIso,
type: FieldType.date,
filter: {
model: Filters.dateRange,
operator: OperatorType.rangeInclusive, // defaults to exclusive
}
},
// ...
];
If you really wish to somehow build a Compound Date Range Filter, your only option left would be to create your own Custom Filter, for that follow the instruction on the Wiki - Custom Filter, you could possible Extend the built-in Date Filter.

Kendo Grid sortable property case sensitive issue

I have a kendo grid i need to sort my column data using sortable:true this property my data in three formats . while sorting it takes Upper case first and lower case letter second (like A B C a b c ....).
Any one knows the solution(I search this through many blogs but i can't)
Here's a solution which replaces the comparer used by the datasource:
https://gist.github.com/JohannesHoppe/4161255
And here's the relevant thread I got that link from (that's also where Sankar's solution is from): http://www.kendoui.com/forums/kendo-ui-web/grid/how-to-enable-case-insensitive-sorting-on-kendo-ui-grid.aspx
(note that case-insensitive sorting is apparently implemented in newer versions of Kendo UI, so you might just want to upgrade)
you can sort on DataSource. So you can add a hidden field to DataSource and make it to lower case. Sort this hidden field.
Here is an example:
userNamen = [];
$.each(obj.users, function(i, el){
userNamen.push({ no: el.no,
name: el.ID,
email: el.email,
fax: el.faxDirect,
phone: el.phoneDirect,
toLowerCase: el.ID.toLowerCase()
});
})
$("##callTo").data("kendoDropDownList").setDataSource(userNamen);
$("##callTo").data("kendoDropDownList").dataSource.sort({ field: "toLowerCase",
dir: "asc" });

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.

Clear jqgrid toolbar when custom defaultvalue is set

I want to clear the toolbar of my grid, but not to the default value of the column. I want to empty all fields.
When I use the
$("#Jqgrid")[0].clearToolbar();
method the toolbar gets the initial default values..
You can choose one from the following two ways.
1) You can temporary change the defaultValue of the searchoptions to "" before call of clearToolbar. You can use setColProp method for example to change column properties (see en example here).
2) Set the value of the the toolbar element manually to "" or to any other value which you want. There are simple way how the ids of the input or select elements of the toolbar are constructed. Let us you have column with the name 'col1' (the corresponding column of colModel has name: 'col1'). Then the id of the element in the filter toolbar will be gs_col1. So you can use
$("#gs_col1").val("");
to clear the field. In more general case if the colname is the variable which hold the value from colModel[i].name you can use
$("#gs_" + $.jgrid.jqID(colname)).val("");

Resources