PDA

View Full Version : [0.8.1] Renderer bug



SouthDeveloper
Jan 22, 2010, 4:43 PM
Hi,

I have been reading on the net, and I see that ExtJs has a delay field por the renderer, and we dont get it on coolite.

What's going on is when I select my rows on client side, I cant get the first row selected since the grid is still rendering.

You need to use 40+ rows.

Any help would be appreciated.

Thanks,



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

if (record.data.RVR_IND_DECISAO == 0) {
<%= GridPanelVeiculo.ClientID %>.getSelectionModel().selectRow(rowIndex);
}

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>

<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>

Vladimir
Jan 24, 2010, 4:41 AM
Hi,

Please provide link where did you see that renderer has delay. Listeners only have delay.


Renderer cannot has the delay because it should return value immedeiately.
If you need to set predefined selection then use SelectedRows collection
http://examples1.ext.net/#/GridPanel/Selection_Models/Row_Selection/

SouthDeveloper
Jan 24, 2010, 3:36 PM
I had to change to server side, since client side aint working.

This is where i found the code with the delay.

http://www.extjs.com/forum/showthread.php?t=41362

Please, try the client side rendering, it aint working properly. The first row is not being selected.

Thanks

Vladimir
Jan 24, 2010, 3:45 PM
Hi,

In that post delay is used for Render event (not grid column renderer). As mentioned in that thread you have to set selection in the Store's Load event (when data is loaded)

SouthDeveloper
Jan 25, 2010, 11:06 AM
Hi,

I tried as you said, still the selectrow on client side is not working.

Please, have it a try.






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


<Listeners>


<Load Delay="1000" />


</Listeners>


<Reader>

Vladimir
Jan 25, 2010, 11:09 AM
Hi,

You did not define handler for Load event

Load Handler="#{GridPanel1}.getSelectionModel().selectRow(0);" Delay="100"/>

SouthDeveloper
Jan 25, 2010, 12:28 PM
It finally worked! Thanks for your help

the final code

Comments: Since the current ext version in use doesnt support Ext.partition, i had to use a workaround to filter.






<Load Handler="#{GridPanelVeiculo}.getSelectionModel().selectReco rds(#{StoreVeiculo}.query('RVR_IND_DECISAO', 0).getRange());"


Delay="100" />