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

How do I always show some items in the grid?

3 Answers 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Balaji
Top achievements
Rank 1
Balaji asked on 13 Dec 2015, 10:24 PM

Hello,

 I don't know whether this question is dumb. Say I have a column called Name with a filter. 

Let's say I have these are the names (Alex,Steve,Mark,ImportantName1,Andrew,ImporantName2). 

Say if I filter for Alex, the grid should not display Alex. It should display (Alex, ImportantName1,ImporantName2).

if I filter for Andrew, the grid should display (ImportantName1,Andrew,ImportantName2). 

I always want to have ImporantantName1 and ImportantName2 to be displayed irrespective of the filter condition. 

If I try to have a custom filter and if I have a filter condition for contains ImportantName, it just displays those 2 items. 

How can I have a smart filter that can always show those 2 important items and the filtered items. 

Thanks.      

3 Answers, 1 is accepted

Sort by
0
Venelin
Telerik team
answered on 15 Dec 2015, 09:03 AM
Hello Balaji,

Actually with custom filtering it should work. You can pass the filtered data set to a list (or whatever structure you like) and then push the important names to this list. Then return the list in the action result.

Regards,
Venelin
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Balaji
Top achievements
Rank 1
answered on 15 Dec 2015, 02:09 PM

Hello Vanelin,

Is there a dojo or something for getting the filtered data, push it to a list? or I should use the change function?

lets say I have a filter like this. This filter just gets the "ImportantNames" and ignores others.  How can I modify this filter to include importantnames and also other names.

var customFilter = function (){

       return {

               field: "BrokerName",

               operator: function(item){

                         return item.indexOf("ImportantName") !== -1;

               }

      }

}

Are you talking about the change event which comes as a part of datasource and that is where I need to handle the filtered data?

var customDataSource = new kendo.data.DataSource({

change: function (e) {

//Modify the list using e.items and add the important names to the list. is it what you are talking about?

}

 

});

 

Thanks.
0
Venelin
Telerik team
answered on 17 Dec 2015, 02:01 PM
Hello Balaji,

Sorry, for some reason I was thinking that the filtering is on server. If it's on client, then you can try to dynamically add custom filters. I have created some sketch of the solution, but you have to modify it in order to fit it to your needs: http://dojo.telerik.com/@vpetrov/uMoQU. In this simple example I push this filter:

_flt.filters.push({
    field: "ShipName",
    operator: "contains",
    value: "Toms Spezialitäten"
})

"Toms Spezialitäten" is the "special name" in this case.

Regards,
Venelin
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Balaji
Top achievements
Rank 1
Answers by
Venelin
Telerik team
Balaji
Top achievements
Rank 1
Share this question
or