PDA

View Full Version : [CLOSED] MultiSelect error



softmachine2011
Jun 15, 2012, 11:26 AM
Hi,

Acording to the following example. Multiselect throws a js exception.
It only crash with this layout configuration, without window seems to works fine. And if event an store use items works too.



<ext:Viewport runat="server" Layout="FitLayout" AutoScroll="true">
<Items>
<ext:Window ID="FiltroWindow" runat="server" IconCls="filter-icon" Title="Filtro"
Width="636" Height="400" MinHeight="400" MinWidth="636" Hidden="false" Border="false"
Modal="true" Maximizable="true">
<Content>
<ext:Panel ID="filtroWrapper" runat="server" Layout="BorderLayout">
<Items>
<ext:Panel ID="filtroContainer" runat="server" Border="false" Layout="BorderLayout"
Region="Center">
<Items>
<ext:Panel ID="filtroContainerWest" runat="server" Split="true" Region="West">
<Items>
<ext:TabPanel ID="tpComandos" runat="server" Border="false" Margins="0" Width="200">
<Items>
<ext:Panel ID="pnlCampos" runat="server" Title="Campos" Border="false" Layout="FitLayout">
<Items>
<ext:MultiSelect ID="lstCampos" runat="server" MultiSelect="false" AnchorVertical="100%"
DisplayField="Etiqueta" ValueField="Etiqueta">
<Store>
<ext:Store ID="dsCampos" runat="server" AutoLoad="false" ShowWarningOnFailure="false">
<Proxy>
<ext:AjaxProxy Url='/Sample/ListaCampos' AutoDataBind="true">
<Reader>
<ext:JsonReader Root="data" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model ID="modelCampos" runat="server">
<Fields>
<ext:ModelField Name="TipoConceptoFiltro" />
<ext:ModelField Name="Etiqueta" />
<ext:ModelField Name="EtiquetaSinTraducir" />
<ext:ModelField Name="Longitud" Type="Int" />
<ext:ModelField Name="IsVisible" Type="Boolean" />
<ext:ModelField Name="Tabla" />
</Fields>
</ext:Model>
</Model>
<Parameters>
<ext:StoreParameter Name="TipoFiltro" Value='sss' Mode="Value" AutoDataBind="true" />
</Parameters>
</ext:Store>
</Store>
</ext:MultiSelect>
</Items>
</ext:Panel>
</Items>
</ext:TabPanel>
</Items>
</ext:Panel>
</Items>
</ext:Panel>
</Items>
</ext:Panel>
</Content>
<Buttons>
<ext:Button ID="btnFiltroAceptar" runat="server" Text="sm_txt_aceptar" />
<ext:Button ID="btnFiltroCancelar" runat="server" Text="sm_txt_cancelar" />
</Buttons>
</ext:Window>
</Items>
</ext:Viewport>


Any solution?

Daniil
Jun 15, 2012, 11:51 AM
Hi,

What is the JS exception? Please always provide more details about errors.

I would apply the following changes.

1. There is no layout in Window. I would set up

Layout="FitLayout"

2. Replace Window

<Content>
with

<Items>

3. BorderLayout requires a Center region to be set up. The "filtroContainer" Panel with BorderLayout has no Center region. So, please put:

<ext:Panel runat="server" Region="Center" />
into its Items.

softmachine2011
Jun 15, 2012, 11:59 AM
With it changes excepting Content for Items because in full version of app this is a Content embedding the same ext.net code (to reuse the control).

I have the same error in this function of Ext MultiSelect JS ( Ext.define('Ext.ux.form.MultiSelect', { ... })


getRecordsForValue: function(value){
var me = this,
records = [],
all = me.store.getRange(),
valueField = me.valueField,
i = 0,
allLen = all.length,
rec,
j,
valueLen;

for (valueLen = value.length; i < valueLen; ++i) { // <-- ERROR HERE
for (j = 0; j < allLen; ++j) {
rec = all[j];
if (rec.get(valueField) == value[i]) {
records.push(rec);
}
}
}

return records;
},

Daniil
Jun 15, 2012, 12:01 PM
This bug has been recently fixed, please update from SVN.

softmachine2011
Jun 15, 2012, 1:10 PM
I'm via NuGET... I'll try in next nuget update.