PDA

View Full Version : Gridpanel scroll the page at the end with grid.selectAll();



Roomy
25 Jun 2013, 4:35 AM
With "#{checkSelectionModel}.select(rowIndex,true);" line of code I try to select all rows in grid, without refresh it move the page at the bottom after selecting each row one by one and I alse apply custom cls on each row as well, Yes selection make perfectly as well.



<ext:Panel ID="PnlForms" Layout="FitLayout" AutoScroll="false" runat="server" Frame="true" Title="Search Results">
<Content>
<div id="LCMGrid">
<ext:GridPanel ID="grd" Scroll="None" runat="server" Border="false" Frame="false"
StoreID="FormsStore" AutoScroll="false" ForceFit="true" Header="false" TabIndex="13">
<Listeners>
<CellClick Fn="function(grid, td, cellIndex, record, tr, rowIndex, e, eOpts)
{
if(cellIndex==0)
{
if(#{checkSelectionModel}.isSelected(rowIndex))
{
#{checkSelectionModel}.setLocked(false);
#{checkSelectionModel}.deselect(rowIndex);
#{checkSelectionModel}.setLocked(true);
}
else
{
#{checkSelectionModel}.setLocked(false);
#{checkSelectionModel}.select(rowIndex,true);
#{checkSelectionModel}.setLocked(true);
}
}
OnCellClick(grid, td, cellIndex, record, tr, rowIndex, e, eOpts);
}" />
</Listeners>
<ColumnModel ID="ColumnModel" runat="server">
<Listeners>
<HeaderClick Fn="function(ct, column, e, t, eOpts )
{
if(column.getIndex() == 0)

{
var hd=Ext.get(ct.el.dom.childNodes[0]);
var isChecked = hd.hasCls('x-grid-hd-checker-on');
var showSelectedOn=false;
if(!showSelectedOn)
{
if(isChecked)
{
selectionHeaderChecked=true;
#{checkSelectionModel}.setLocked(false);
#{checkSelectionModel}.selectAll();
#{checkSelectionModel}.setLocked(true);
}
else
{
selectionHeaderChecked=false;
#{checkSelectionModel}.setLocked(false);
#{checkSelectionModel}.deselectAll();
#{checkSelectionModel}.setLocked(true);
}
}
else
{
if(!selectionHeaderChecked)
{
hd.addCls('x-grid-hd-checker-on');
}
else
{
hd.removeCls('x-grid-hd-checker-on');
}
}
}
}" />
<ColumnMove Fn="CheckboxSelectedOnColum" />
</Listeners>
<Columns>

Column List...
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CheckboxSelectionModel HeaderWidth="18" runat="server" ID="checkSelectionModel"
Mode="Multi">
<Listeners>
<Select Handler="UnchecHeader(#{checkSelectionModel});" />
<Deselect Handler="UncheckCheckHeader(#{checkSelectionModel});" />
</Listeners>
</ext:CheckboxSelectionModel>
</SelectionModel>
<View>
<ext:GridView runat="server" BorderSpec="0" TrackOver="false" StripeRows="True">
<GetRowClass Fn="getRowClass" />
<Listeners>
<Refresh Handler="UncheckCheckHeader(#{checkSelectionModel});" />
</Listeners>
</ext:GridView>
</View>
<Features>
<ext:Grouping runat="server" HideGroupedHeader="true" GroupHeaderTplString="{columnName}: {renderedGroupValue}" />
</Features>
</ext:GridPanel>
</div>
</Content>
</ext:Panel>

suzuki1100nz
26 Jun 2013, 12:48 AM
So what do you need help with?

Roomy
26 Jun 2013, 3:50 AM
I want to remove auto focus.

Roomy
26 Jun 2013, 10:26 AM
the problem arrived due to focus, when select a row it got focused and page move row by row till the end. Pls suggest me any solution for that.

slemmon
26 Jun 2013, 9:35 PM
You can use selectAll(true) to suppress the selection event that then focuses the row.

Roomy
27 Jun 2013, 12:09 AM
thanks,
I try this but it affect the working of custome function
used to checkbox checked and then unselect a row,header check will be unchecked
function UncheckCheckHeader(control)