Hello,
I'm using a RadGrid with dynamic columns and column filtering. I'm also setting a filter template for the columns I want to have this feature. Everything is working fine except for one thing I'm trying.
When I send the filter command on the client-side:
1.
tableView.filter(columnUnique, searchValue, condition);
I also set a css class on an element of my template.
I see this element changing but when the filter command is completed, it's gone.
Well, I implemented so far:
- The columns on the grid are defined during the page_init
- During this initialization, I set the filter templates too
This is an example of one of my templates:
01.
public TextTemplate(Page _page, RadGrid _grid, RadContextMenu _menu, GridColumnSetting _column)
02.
{
03.
page = _page;
04.
grid = _grid;
05.
menu = _menu;
06.
columnSettings = _column;
07.
08.
panel = (Panel)page.LoadControl(
typeof
(Panel),
null
);
09.
panel.ID =
"ftrPnl_text_"
+ columnSettings.DataMember;
10.
panel.CssClass =
"ftrPnl"
;
11.
12.
panel2 = (Panel)page.LoadControl(
typeof
(Panel),
null
);
13.
panel2.ID =
"ftrIpt_text_"
+ columnSettings.DataMember;
14.
panel2.CssClass =
"ftrIpt"
;
15.
16.
textBox = (CustomTextBox)page.LoadControl(
"~/Controls/CustomTextBox.ascx"
);
17.
textBox.ID =
"txt0_"
+ columnSettings.DataMember;
18.
textBox.ToolTip = columnSettings.ColumnToolTip;
19.
20.
button = (Button)page.LoadControl(
typeof
(Button),
null
);
21.
button.ID =
"btn_filter_"
+ columnSettings.DataMember;
22.
button.UseSubmitBehavior =
false
;
23.
button.CssClass =
"ftrTxt rgFilter btn_filter"
;
24.
25.
hidden = (HiddenField)page.LoadControl(
typeof
(HiddenField),
null
);
26.
hidden.ID =
"hdn_filter_"
+ columnSettings.DataMember;
27.
}
28.
29.
public void InstantiateIn(Control container)
30.
{
31.
textBox.OnClientKeyDown =
32.
"filterOnEnter('"
+ hidden.ID +
"', 'text', '"
+ button.ID +
"');"
;
33.
34.
hidden.Value =
35.
grid.ClientID + FLP.SEPPROP +
36.
columnSettings.DataMember + FLP.SEPPROP +
37.
textBox.ClientID + FLP.SEPPROP +
38.
columnSettings.FilterFunction.AsString();
39.
40.
button.OnClientClick = FilterButtonJS();
41.
42.
panel2.Controls.Add(textBox);
43.
panel.Controls.Add(panel2);
44.
panel.Controls.Add(button);
45.
46.
container.Controls.Add(panel);
47.
container.Controls.Add(hidden);
48.
}