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

[Solved] How set default item in dropdown list in grid filtering menu

1 Answer 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marcin
Top achievements
Rank 1
Marcin asked on 04 Apr 2012, 10:07 AM
Hello,
I want set default item in dropdown lists in grid filtering menu. I found two files which contains variables filtering (for example: filterStringSubstringOf: "Contains") telerik.grid.min.js and telerik.all.min.js. I changed order of filtering variables so that first element was filterStringSubstringOf: "Contains" but always when filtering menu is shown default item in dropdown list is another than "Contains".
How can I set "Contains" as default item in dropdown list in grid filtering menu.

1 Answer, 1 is accepted

Sort by
0
Marcin
Top achievements
Rank 1
answered on 04 Apr 2012, 10:54 AM

I found solution this problem. In file telerik.grid.filtering.min.js exist function:

 

b.filtering.implementation = {
createFilterCommands: function (i, g) {
var h = [];
a.each(this.localization, function (k, m) {
var l = "filter" + (g.data ? "ForeignKey" : g.type);
var j = k.indexOf(l);
if (j > -1) {
h.push({
key: k.substring(j + l.length).toLowerCase(),
value: m
})
}
});
if (g.type == "String") {
if (h[0].key !== "eq") {
h.push(h.shift())
}
}
i.cat('<select class="t-filter-operator">');
a.each(h, function (k, j) {
i.cat('<option value="').cat(j.key).cat('">').cat(j.value).cat("</option>")
});
i.cat("</select>")
},
 

If somebody want change default item selected in dropdownlists in filtering menu must look to lines :

if (g.type == "String") {
if (h[0].key !== "eq") {
h.push(h.shift())
}

Tags
Grid
Asked by
Marcin
Top achievements
Rank 1
Answers by
Marcin
Top achievements
Rank 1
Share this question
or