This is a migrated thread and some comments may be shown as answers.

general filter on grid

8 Answers 240 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 14 Feb 2012, 08:48 PM
Hi,

Still testing your framework to see whether we can migrate, so here's another issue we run into.
Our current grid has one text field in the bottom left which when a value entered there, sends it to the server (all our data is remotely fetched using ajax), and on the server, we have logic to determine what fields we should earch for using this "simpleSearchValue".

For instance, for parties it would be looking into first name, last name, and address; using an OR filter, it would return all rows of which at least one column matches the data...

Consider it a "column-independent string filter".

How can we achieve this using the Kendo framework?

I hope this can be achieved as this would be a major showstopper for this project, and that would be a real pity as we're pretty impressed with the framework so far :o)

8 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 15 Feb 2012, 09:04 AM
Hi David,

You can achieve similar to the requested functionality by using the DataSource filter method as shown in the this online demo. Note that in order to use OR filtering you should build a filter expression in the following format:

{
   logic: "or",
   filters: [
      { field: "orderId", operator: "neq", value: 42 },
      { field: "unitPrice", operator: "ge", value: 3.14 }
   ]
}


Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 15 Feb 2012, 10:19 AM
Yes, I undertand, but this will create two inputs, right?  I just want the user to enter his search value ONCE.  
0
Rosen
Telerik team
answered on 16 Feb 2012, 08:33 AM
Hi David,

I'm afraid I'm not sure how this is related to number of inputs use in the UI. The use of DataSource's filter method mentioned in my previous message is not directly related to any UI elements, it is up to the developer to construct the UI and build the filter expression. 
Another approach, in case you just want to send a parameter value to the server, is not to use the DataSource filtering API but directly send the values through the request. As shown in this online demo.

All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 16 Feb 2012, 02:48 PM
I'm sorry - I was completely wrong.

For some reason, I was under the impression that the filter options was an option in the grid so that a user would be able to click the header of a column and filter data there.  I now just notice that your grid doesn't support any filtering at all?

So if i'm not mistaking, I should be looking at the toolbar in the grid which should allow me to add an input there, and add an onchange event there to trigger the filtering on the datasource of the grid.  Correct?

How can we get the datasource object of a grid, sowe can call it's filter() method?
0
Rosen
Telerik team
answered on 16 Feb 2012, 03:24 PM
Hi David,

Our grid has a built-in filtering UI and capabilities, which can be seen in this online demo. However, as you have requested a separate input element, from which to filter the data, I have pointed you to the DataSource API and the Grid's toolbar.

You can get reference to Grid's DataSource through the dataSource field:

$(document).ready(function(){
     var dataSource =  $("#grid").kendoGrid().dataSource;
});

All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 16 Feb 2012, 03:38 PM
Hi,

thanks for the update.  It would just be a nice feature if you could add two features:

1. to your dataSource - have the ability to add a filter that is valid for all fields (as we needed); ideally we would be wanting to combine this with a filter for specific fields (for instance: give me all parties which are born in 1980 (dateofbirth between 01/01/1980 and 31/12/1980), and apply the general filter "david" which would mean "of which the first name or the last name, or the address contain "david".

2. add the "generalfilter" option to the grid so it automatically shows in the toolbar, and we don't need to add another layer to our code to make this available ourselves...

It's just something we need so frequently that it would be absolutely great if it could be added as a part of your widgets, and I personally feel that MANY applications need something like this...

thanks for the update though - nice to see you put so much effort in pre-sales support.
0
Rosen
Telerik team
answered on 17 Feb 2012, 10:59 AM
Hi David,

I'm afraid that this is not possible as such filter will yield a huge performance penalty. Therefore, you should consider implementing is using DataSource API as discussed previously.

Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Juan
Top achievements
Rank 1
answered on 26 Mar 2012, 08:23 PM
Hi, can you show an example using xml data and filtering?
Thks
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Rosen
Telerik team
David
Top achievements
Rank 1
Juan
Top achievements
Rank 1
Share this question
or