PDA

View Full Version : [0.8.2] Selecting rows from client side



SouthDeveloper
Jan 22, 2010, 5:31 PM
Hi,

I have a store that I populate on page_load. When I show a window i want show the rows selected on this store. I dont know why, but the rows show selected for a couple secs then i get unselected by itselves :(

Any help would be appreciated





<ext:Window AutoHeight="true" BodyStyle="background-color: #fff; padding: 6px" Icon="CarAdd"
ID="WindowVeiculo" Draggable="true" Modal="false" Resizable="false" runat="server"
Title="Seleção de veículo" Width="600" Show&#111;nload="true">
<Body>
<ext:Panel Border="false" Cls="window-padding" Frame="true" Title="Informações" runat="server">
<Body>
<ext:FormLayout runat="server">
<ext:Anchor>
<ext:Label ID="LabelCodigoBeneficio" FieldLabel="Código benefício" runat="server"
Text="Benefício" />
</ext:Anchor>
<ext:Anchor>
<ext:Label ID="LabelDescricao" FieldLabel="Descrição" runat="server" Text="Benefício" />
</ext:Anchor>
<ext:Anchor>
<ext:Label ID="LabelFonteLegal" FieldLabel="Fonte legal" runat="server" Text="Benefício" />
</ext:Anchor>
</ext:FormLayout>
</Body>
</ext:Panel>
<ext:Panel Border="false" Cls="window-padding" runat="server">
<Body>
<ext:FormLayout runat="server">
<ext:Anchor>
<ext:GridPanel AutoHeight="true" AutoExpandColumn="dsMarcaModelo" ID="GridPanelVeiculo"
runat="server" StoreID="StoreVeiculo" StripeRows="true">
<ColumnModel runat="server">
<Columns>
<ext:Column Header="Renavam" Sortable="true" DataIndex="NURENAVAM">
</ext:Column>
<ext:Column Header="Placa" Sortable="true" DataIndex="DSPLACAVEICULO" />
<ext:Column ColumnID="dsMarcaModelo" Header="Modelo" Sortable="true" DataIndex="DSMARCAMODELO" />
<ext:Column Header="Ano fabricação" Sortable="true" DataIndex="DSANOFRABRICACAO">
<Renderer Fn="renderVeiculo" />
</ext:Column>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CheckboxSelectionModel ID="SelectionModelVeiculo" runat="server"/>
</SelectionModel>
<BottomBar>
<ext:PagingToolbar runat="server" PageSize="10" />
</BottomBar>
</ext:GridPanel>
</ext:Anchor>
</ext:FormLayout>
</Body>
</ext:Panel>
</Body>
<Buttons>
<ext:Button ID="WindowButtonSalvar" Text="Salvar" Icon="Disk" runat="server">
<Listeners>
<Click Handler="if (#{SelectionModelVeiculo}.getCount() != 0) {#{WindowVeiculo}.hide(); return true;} Ext.MessageBox.alert('Aviso','É necessário selecionar ao menos um veículo'); return false; " />
</Listeners>
</ext:Button>
<ext:Button Text="Cancelar" Icon="Cancel" runat="server">
<Listeners>
<Click Handler="#{GridPanelBeneficios}.getSelectionModel().deselec tRow(row); #{WindowVeiculo}.hide(); " />
</Listeners>
</ext:Button>
</Buttons>
<Listeners>
<Show Handler="this.el.center(Ext.getBody());" />
</Listeners>
</ext:Window>







var renderVeiculo = function (value, metadata, record, rowIndex, colIndex, store){








// 0 = Selecionado


if (record.data.RVR_IND_DECISAO == 0) {


<%= GridPanelVeiculo.ClientID %>.getSelectionModel().selectRow(rowIndex);





// <%= GridPanelVeiculo.ClientID %>.getSelectionModel().selectRow(0);


// record.data.RVR_IND_DECISAO = 0;


}





return value;


}






<ext:Store ID="StoreVeiculo" runat="server">


<Reader>


<ext:JsonReader ReaderID="NURENAVAM">


<Fields>


<ext:RecordField Name="NURENAVAM" />


<ext:RecordField Name="DSPLACAVEICULO" />


<ext:RecordField Name="DSMARCAMODELO" />


<ext:RecordField Name="DSANOFRABRICACAO" />


<ext:RecordField Name="RVR_RTB_NUM_BENEFICIO" />


<ext:RecordField Name="RVR_IND_DECISAO" />


<%--Se est selecionado--%>


</Fields>


</ext:JsonReader>


</Reader>


</ext:Store>