jQWidgets Forums
jQuery UI Widgets › Forums › Angular › filter row apply empty filter
Tagged: angular grid, grid, typescript grid
This topic contains 3 replies, has 3 voices, and was last updated by Hristo 7 years, 7 months ago.
-
Author
-
Hello,
I have some time span columns which are in DB as a number and in backend I am formatting them as a time by user preferences, so column data in UI is the string and I want to apply number filter type to my column to have number dropdown items(greater than, lesser than and etc) then this is causing me two issue:
first, is applying two filter row to my column and second, it changes the item chosen from dropdown with equivalence from string filtering option(like contain and …) like this:
filter criteria:
0:[{filterColumn: “FWRoute.ProjectedWorkTime”, filterValue: 0, filterCondition: “EMPTY”,…},…]
1:{filterColumn: “FWRoute.ProjectedElapsedTime”, filterValue: 10, filterCondition: “CONTAINS”,…}this app is in angular 4, so I prepared a jsfiddle example which in there just happening the first issue:
https://jsfiddle.net/tanhabad/YsNT2/632/what I did was that I removed data field type for the time span columns and in column definition, I filled “filtertype:’number'”.
so my question is how can I apply a server-side number filter to my formatted time(hh:mm:ss) string columns?Hi Najme,
I can’t quite understand what you want. Do you want to apply server site filtering?
I am not guided by the example given.
Can you please share some sample data, the grid settings and other needed things for me to get a glance at the outcome you desire?Best Regards,
IvojQWidgets Team
http://www.jqwidgets.com/Hi Ivo,
this is my grid:
<jqxGrid #routeDashboard_Main_routesGrid (onRowselect)=’onRowSelect($event)’ (onRowunselect)=’onRowUnselect()’
(onCellclick)=”CellClick($event)” (onRowexpand)=’onRowExpand($event)’
[id]='”RoutesGrid”‘ [height]=”‘100%'” [width]=”‘100%'”
[source]=’routesAdapter’ [columns]=’columns’ [virtualmode]=’true’ [auto-create]=’false’
[rowdetails]=’true’
[initrowdetails]=’initRowDetails’ [ready]=’ready’ [rowdetailstemplate]=’rowdetailstemplate’
[selectionmode]='”checkbox”‘ [showfilterrow]=’false’ [filterable]=’true’ [sortable]=’true’ [columnsmenu]=’false’ [columnsresize]=’true’
[rendergridrows]=’rendergridrows’ [rowsheight]=’25’ [showdefaultloadelement]=”false”
[autoshowloadelement]=”false” [cellhover]=’RowHover’
>
</jqxGrid>this is one of the column field :
{datafield:”projectedElapsedTime” filtertype:”number” hidden:false text:”Projected Elapsed Time” width:”80″}this is one of the data field:
{type: null, name: “projectedElapsedTime”}example of my data in column UI from server:
projectedElapsedTime:”03:47:08″and as you can see I want to have number filter on the string column and yes filter is server side and this is my filter function :
filter: (cellValue, rowData, dataField, filterGroup, defaultFilterResult) => {
if (this.isFilterRow) {
if (this.loadingState) {
this.filterGrid(null);
this.myGrid.updatebounddata(‘filter’);
}
}
}and this is the json object is sent to the server :
0:{filterColumn: “FWResource.WindupTime”, filterValue: 0, filterCondition: “EMPTY”, filterOperator: 0,…}
1:{filterColumn: “FWRoute.ActualElapsedTime”, filterValue: 0, filterCondition: “EMPTY”,…}
2:{filterColumn: “FWRoute.PlannedElapsedTime”, filterValue: 10, filterCondition: “GREATER_THAN”,…}it is applying some waste empty filter conditions I just applied the 2 filter and the other is added automatically.
Best Regards,
NajmeHello Najme,
I would like to suggest you look at this tutorial, about the server filtering:
https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-filtering.htm?search=grid
Also, please take a look at this demo:
https://www.jqwidgets.com/jquery-widgets-demo/demos/php/serverfiltering.htm?light
There is some misunderstanding you “want to have number filter on the string column”. Could you clarify it?
From the provided data it looks like you have DateTime column and maybe it will be better.PS: The presented examples are not on Angular but they are better for understanding these concepts.
Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.