PDA

View Full Version : [CLOSED] [2.3][Store][GridPanel] Remote paging causes ${ to be replaced with Ext.select



lasting
May 14, 2014, 8:06 AM
I encountered a problem when using GridPanel with remote paging. If one of the fields displayed in the GridPanel has the characters ${, Ext replaces those characters with Ext.select(""). This problem occurs only with remote paging, like the example below. If i remove the page proxy & the refresh event, the gridpanel displays ok.

How can I avoid this replace? Is there a property on Store/GridPanel/ResourceManager?

The following code is a test example for this issue:


<%@ 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)
{
this.Store1.DataSource = this.Data;
this.Store1.DataBind();
}
}

public void EntityStoreMaterials_RefreshData(object sender, StoreReadDataEventArgs e)
{
e.Total = Data.Length;
this.Store1.DataSource = GMWeb.Utils.Helpers.RemoteOperationsHelper.GetValu es(e, Data.ToList());
this.Store1.DataBind();
}

private object[] Data
{
get
{
return new object[]
{
new object[] { "3m ${ Co", 71.72, 0.02, 0.03, "9/1 12:00am" }
};
}
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Simple Array Grid - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />

<style>
.x-grid-row-over .x-grid-cell-inner {
font-weight: bold;
}
</style>

<script>
var template = '<span style="color:{0};">{1}</span>';

var change = function (value) {
return Ext.String.format(template, (value > 0) ? "green" : "red", value);
};

var pctChange = function (value) {
return Ext.String.format(template, (value > 0) ? "green" : "red", value + "%");
};
</script>
</head>
<body>
<ext:ResourceManager runat="server" />

<h1>Simple Array Grid</h1>

<ext:GridPanel
ID="GridPanel1"
runat="server"
Title="Array Grid"
Width="600"
Height="350">
<Store>
<ext:Store ID="Store1" runat="server" PageSize="10" OnReadData="EntityStoreMaterials_RefreshData">
<Proxy>
<ext:PageProxy>
<Reader>
<ext:JsonReader></ext:JsonReader>
</Reader>
</ext:PageProxy>
</Proxy>
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="company" Type="String" />
<ext:ModelField Name="price" Type="Float" />
<ext:ModelField Name="change" Type="Float" />
<ext:ModelField Name="pctChange" Type="Float" />
<ext:ModelField Name="lastChange" Type="Date" DateFormat="M/d hh:mmtt" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column runat="server" Text="Company" DataIndex="company" Flex="1" />
<ext:Column runat="server" Text="Price" DataIndex="price">
<Renderer Format="UsMoney" />
</ext:Column>
<ext:Column runat="server" Text="Change" DataIndex="change">
<Renderer Fn="change" />
</ext:Column>
<ext:Column runat="server" Text="Change" DataIndex="pctChange">
<Renderer Fn="pctChange" />
</ext:Column>
<ext:DateColumn runat="server" Text="Last Updated" DataIndex="lastChange" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel runat="server" />
</SelectionModel>
<BottomBar>
<ext:Toolbar runat="server">
<Items>
<ext:Button runat="server" Text="Print" Icon="Printer" Handler="this.up('grid').print();" />
</Items>
</ext:Toolbar>
</BottomBar>
</ext:GridPanel>
</body>
</html>

This is the error that appears when loading the above example:
http://forums.ext.net/attachment.php?attachmentid=10981&stc=1

Daniil
May 14, 2014, 8:28 AM
Hi @lasting,

Please try:

TokenUtils.Settings.Disable = true;
this.Store1.DataSource = GMWeb.Utils.Helpers.RemoteOperationsHelper.GetValu es(e, Data.ToList());

lasting
May 14, 2014, 9:09 AM
Hi @lasting,

Please try:

TokenUtils.Settings.Disable = true;
this.Store1.DataSource = GMWeb.Utils.Helpers.RemoteOperationsHelper.GetValu es(e, Data.ToList());

I tried like mentioned above and the error did not appear anymore, but neither the data. I also tried setting just the SelectParsingDisable property and the result was the same, as seen in the print screen below.

11001

Daniil
May 14, 2014, 11:50 AM
I guess you need to use <ext:ArrayReader> instead of <ext:JsonReader>.

lasting
May 14, 2014, 2:05 PM
I guess you need to use <ext:ArrayReader> instead of <ext:JsonReader>.

Yeah, using ArrayReader and setting
TokenUtils.Settings.SelectParsingDisable = true works.

Thank you!