PDA

View Full Version : [CLOSED] GridPanel reconfigure issue



snow_cap
Dec 10, 2013, 2:22 PM
This function is used to update the content of a component column inside a GridPanel containing 5 different controls.
Depending on the type of the field, an index is returned and the control is loaded after the reconfigure call
Each control in the different columns has its own store (bound by the StoreId attribute of the control) which is populated depending on the selection of the preceding column. Once the reconfigure call is made, the stores from the control are returning undefined
On selecting an item from the combo box am receiving JavaScript error :


{var b=this.store,a=b.findExact(d,c)

Page Code:



var LoadOperators = function (a, b, c) {
var grid = Ext.getCmp('GridPanel1');
var store = grid.store;
var view = Ext.getCmp('ViewNameHidden').value;
var field = b.value;
Ext.getCmp('fieldNameHidden').text = field;
App.direct.LoadComboBoxOperators(view, field, {
success: function (result) {
var newIndex = 0;
store.getAt(store.count() - 1).data.Type = result;
switch (result) {
case 'ESTextBox':
newIndex = 0;
break;
case 'ESCalendar':
newIndex = 1;
break;
case 'ESCheckBox':
newIndex = 2;
break;
case 'ESDataCombo':
newIndex = 3;
break;
case 'ESLinkGen':
newIndex = 4;
break;
}
App.StoreGrid.data.getAt(b.rowIdx).data.Index = newIndex;
App.GridPanel1.reconfigure();
}
});
};

<body>
<form id="form" runat="server" method="post">
<ext:ResourceManager ID="ResourceManager" runat="server">
</ext:ResourceManager>



<ext:Store ID="CriteriaStore" IDMode="Static" runat="server">
<Model>
<ext:Model ID="Model3" runat="server">
<Fields>
<ext:ModelField Name="Index" />
<ext:ModelField Name="Name" />
<ext:ModelField Name="Value" />
</Fields>
</ext:Model>
</Model>
</ext:Store>

<ext:Store ID="StoreFields" IDMode="Static" runat="server">
<Model>
<ext:Model ID="Model2" runat="server">
<Fields>
<ext:ModelField Name="FIELDNAME" />
<ext:ModelField Name="FIELDDESCRIPTION" />
</Fields>
</ext:Model>
</Model>
</ext:Store>


<ext:Store ID="ComboStore" IDMode="Static" runat="server">
<Model>
<ext:Model ID="Model4" runat="server">
<Fields>
<ext:ModelField Name="Index" />
<ext:ModelField Name="Name" />
<ext:ModelField Name="Value" />
</Fields>
</ext:Model>
</Model>
</ext:Store>

<ext:Store ID="StoreView" IDMode="Static" runat="server">
<Model>
<ext:Model runat="server" ID="ModelViews">
<Fields>
<ext:ModelField Name="ESCOUNT" />
<ext:ModelField Name="ESDESCRIPTION" />
<ext:ModelField Name="ESVIEWNAME" SortType="AsText" SortDir="Default" />
</Fields>
</ext:Model>
</Model>
</ext:Store>

<ext:Store runat="server" ID="StoreGrid" IDMode="Static" AutoDataBind="True">
<Model>
<ext:Model ID="ModelFields" runat="server">
<Fields>
<ext:ModelField Name="Index" />
<ext:ModelField Name="ViewDescription" />
<ext:ModelField Name="ViewId" />
<ext:ModelField Name="Field" />
<ext:ModelField Name="Criteria" />
<ext:ModelField Name="Values" />
<ext:ModelField Name="Operator" />
<ext:ModelField Name="FieldId" />
<ext:ModelField Name="CriteriaValue" />
<ext:ModelField Name="OperatorValue" />
<ext:ModelField Name="Type" />
<ext:ModelField Name="TypeDate" />
<ext:ModelField Name="Retfield" />
<ext:ModelField Name="IsParam" />
</Fields>
</ext:Model>
</Model>
</ext:Store>

<ext:Viewport ID="MainPort" runat="server" Layout="FitLayout" Border="false">
<Items>
<ext:Panel ID="pnlReportQuery" runat="server" Region="Center" Border="false">
<TopBar>
<ext:Toolbar runat="server" ID="ToolbarSave">
<Items>
<ext:Button ID="btnSave" runat="server" Text="Save" Icon="ReportEdit">
<Listeners>
<Click Handler="Save(#{btnSave}.id)" />
</Listeners>
</ext:Button>
<ext:ToolbarSeparator runat="server" />
<ext:Button ID="btnSaveAs" runat="server" Text="Save As New Report" Icon="ReportDisk">
<Listeners>
<Click Handler="Save(#{btnSaveAs}.id)" />
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<Items>
<ext:Container runat="server" ID="MainContainer" Layout="FitLayout" Border="false">
<Items>
<ext:Container ID="Container1" runat="server" ColumnWidth="1" Layout="ColumnLayout">
<Items>
<ext:Container ID="Criteriacontainer" runat="server" ColumnWidth="1" Layout="TableLayout">
<Items>
<ext:Checkbox runat="server" ID="GeneralReportCheckBox" Padding="10">
<Listeners>
<Change Handler="ToggleGrid(#{GeneralReportCheckBox}.checked)"></Change>
</Listeners>
</ext:Checkbox>
<ext:Label runat="server" ID="GeneralReportLabel" Text="General Report"></ext:Label>
</Items>
</ext:Container>


<ext:Container ID="GridContainer" ColumnWidth="1" runat="server" Border="false">
<Items>
<ext:Panel ID="PanelGrid" runat="server" Layout="FitLayout" Border="true" Height="500">
<Items>
<ext:GridPanel runat="server" ID="GridPanel1" StoreID="StoreGrid"
Border="false" Region="Center">
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server">
</ext:RowSelectionModel>
</SelectionModel>
<ColumnModel runat="server" AutoDataBind="True" EnableColumnHide="True" EnableColumnMove="False">
<Columns>
<ext:ComponentColumn ID="ViewCompCol" runat="server" IDMode="Static" Editor="True"
Text="View"
DataIndex="ViewDescription"
Width="250"
Resizable="False">
<Component>
<ext:ComboBox runat="server" ID="ViewComboBox" StoreID="StoreView" />
</Component>
<Listeners>
<Edit Fn="LoadFields"></Edit>
</Listeners>
</ext:ComponentColumn>

<ext:ComponentColumn ID="FieldColumn" runat="server"
Text="Field"
DataIndex="Field"
Editor="True"
Width="200"
Resizable="False">
<Component>
<ext:ComboBox runat="server" ID="FieldComboBox" IDMode="Static" StoreID="StoreFields" DisplayField="FIELDDESCRIPTION" ValueField="FIELDNAME" Width="200">
<%-- <Listeners>
<Expand Fn="LoadFields"></Expand>
</Listeners>--%>
</ext:ComboBox>
</Component>
<Listeners>
<Edit Fn="LoadOperators"></Edit>
</Listeners>
</ext:ComponentColumn>

<ext:ComponentColumn ID="CriteriaCol" runat="server"
Text="Comparator"
DataIndex="Criteria"
Editor="True"
Width="120"
Resizable="False">
<Component>
<ext:ComboBox runat="server" IDMode="Static" ID="ComboBoxCriteria" DisplayField="Name" ValueField="Value" StateID="ComboBoxCriteria" StoreID="CriteriaStore">
</ext:ComboBox>
</Component>

</ext:ComponentColumn>

<ext:ComponentColumn ID="TextFieldValueColumn" runat="server"
Text="Value"
Editor="True"
DataIndex="Values"
Hidden="False"
Width="300" Resizable="False">
<Component>
<ext:TextField runat="server" ID="TextFieldValue">
</ext:TextField>

<ext:DateField runat="server" ID="DatePickerValue">
</ext:DateField>
<ext:Checkbox runat="server" ID="CheckboxValue">
</ext:Checkbox>

<ext:ComboBox runat="server" ID="ComboBoxValue" StoreID="ComboStore" IDMode="Static" DisplayField="Name" ValueField="Value">
</ext:ComboBox>

<ext:DateField runat="server" ID="DatePickerValueFrom">
</ext:DateField>
<ext:DateField runat="server" ID="DatePickerValueTo"
Disabled="True">
</ext:DateField>

</Component>
<Listeners>
<BeforeBind Handler="if(e.record.data.Index!=''){BeforeGridBind(e)}" />
</Listeners>
<Renderer Fn="GridRenderer" />
</ext:ComponentColumn>


<ext:ComponentColumn ID="OperatorColumn"
runat="server"
DataIndex="Operator"
Text="Operator" Width="45"
Editor="true">
<Component>
<ext:ComboBox ID="OperatorComboBox" runat="server" DisplayField="Name" ValueField="Value">
<Store>
<ext:Store ID="OperatorStore" runat="server">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="Index" />
<ext:ModelField Name="Name" />
<ext:ModelField Name="Value" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>
</Component>

</ext:ComponentColumn>

<ext:ComponentColumn ID="ComponentColumn3"
runat="server"
DataIndex="IsParam"
Editor="True"
Text="Parameter" Width="45">
<Component>
<ext:Checkbox IDMode="Static" ID="ParameterCheckBox" runat="server" />
</Component>
</ext:ComponentColumn>

<ext:CommandColumn ID="CommandColumn1" Width="30" runat="server">
<Commands>
<ext:GridCommand Icon="BulletCross" CommandName="Delete">
<ToolTip Text="Delete" />
</ext:GridCommand>
</Commands>
<Listeners>
<Command Handler="DeleteRow(record)" />

</Listeners>
</ext:CommandColumn>
<ext:CommandColumn ID="CommandColumn2" Width="30" runat="server">
<Commands>
<ext:GridCommand Icon="Add" CommandName="Add">
<ToolTip Text="Add" />
</ext:GridCommand>
</Commands>
<Listeners>
<Command Handler="AddRow()"></Command>
</Listeners>
</ext:CommandColumn>
<ext:ComponentColumn runat="server" ID="HiddenFieldValue" Text="Type" Editor="true" DataIndex="FieldId" Hidden="True">
<Component>
<ext:TextField runat="server" Text=""></ext:TextField>
</Component>
</ext:ComponentColumn>
<ext:Column runat="server" ID="HiddenViewId" Editor="true" DataIndex="ViewId" Hidden="True" />
<ext:Column runat="server" ID="HiddenCriteriaValue" Editor="true" DataIndex="CriteriaValue" Hidden="True" />
<ext:Column runat="server" ID="HiddenOperatorValue" Editor="true" DataIndex="OperatorValue" Hidden="True" />
<ext:Column runat="server" ID="HiddenType" DataIndex="Type" Hidden="True" />
</Columns>
</ColumnModel>
</ext:GridPanel>
</Items>
</ext:Panel>
</Items>
</ext:Container>
</Items>
</ext:Container>
</Items>
</ext:Container>
</Items>
</ext:Panel>

</Items>
</ext:Viewport>
<ext:Hidden runat="server" ID="txtEdit" Text="" />
<ext:Hidden runat="server" ID="ViewNameHidden" Text="" />
<ext:Hidden runat="server" ID="fieldNameHidden" Text="" />
<ext:Hidden runat="server" ID="FieldType" />
<ext:Hidden runat="server" ID="FieldTypeDate" />
<ext:Hidden runat="server" ID="WhereHidden" />
<ext:Hidden runat="server" ID="ReportID" />
<ext:Hidden runat="server" ID="ReportTitle" />
</form>

</body>

Baidaly
Dec 10, 2013, 8:58 PM
Hello!

Sorry, but your sample is not runnable. Could you provide a runnable sample to reproduce the issue?