Oct 19, 2010, 12:41 PM
[CLOSED] Data selection case sensitive on Store with row selection issue
Hi,
In the following example, you will be able to see 2 problems where the first one is my main issue:
1. Selection Model is case-sensitive and I'd like it to behave like insensitive, that means, select the row when clicking in the button ignoring case.
2. Renderer Format="LowerCase" seems not to be working. UpperCase works fine.
Of course I could convert Column1 on DataLayer level, but in my scenario it has implications.
I also tried to convert like Data Prepare Sample but if I change the data to lowercase on Convert handler nothing gets displayed. I don't know what I was doing wrong.
Regards,
Leo
In the following example, you will be able to see 2 problems where the first one is my main issue:
1. Selection Model is case-sensitive and I'd like it to behave like insensitive, that means, select the row when clicking in the button ignoring case.
2. Renderer Format="LowerCase" seems not to be working. UpperCase works fine.
Of course I could convert Column1 on DataLayer level, but in my scenario it has implications.
I also tried to convert like Data Prepare Sample but if I change the data to lowercase on Convert handler nothing gets displayed. I don't know what I was doing wrong.
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[] {
new object[] {"firsttest", "firsttest" },
new object[] {"SecondTest", "SecondTest" },
new object[] {"thirdTest", "thirdTest" }
};
store.DataBind();
}
}
protected void Select_Click(object sender, DirectEventArgs e)
{
RowSelectionModel sm = this.GridPanel1.SelectionModel.Primary as RowSelectionModel;
sm.SelectedRows.Add(new SelectedRow("firsttest"));
sm.SelectedRows.Add(new SelectedRow("secondtest"));
sm.UpdateSelection();
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Ext.Net Example</title>
<script type="text/javascript">
var prepare = function(value, rec) {
rec[0] = value.toString.toLowerCase();
};
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
<Store>
<ext:Store ID="Store1" runat="server">
<Reader>
<ext:ArrayReader IDProperty="Column1">
<Fields>
<ext:RecordField Name="Column1">
<Convert Fn="prepare" />
</ext:RecordField>
<ext:RecordField Name="Column2" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column Header="Column 1" DataIndex="Column1">
<Renderer Format="LowerCase" />
</ext:Column>
<ext:Column Header="Column 2" DataIndex="Column2">
<Renderer Format="LowerCase" />
</ext:Column>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" SingleSelect="false" />
</SelectionModel>
<Buttons>
<ext:Button ID="ButtonSelect" runat="server" Text="Select Rows">
<DirectEvents>
<Click OnEvent="Select_Click" />
</DirectEvents>
</ext:Button>
</Buttons>
</ext:GridPanel>
</form>
</body>
</html>
Your help is much appreciated.Regards,
Leo
Last edited by Daniil; Oct 20, 2010 at 2:35 PM.
Reason: [CLOSED]