PDA

View Full Version : [FIXED] [#204] [2.2] RowNumberer resets to 1 when you page



jchau
Apr 12, 2013, 6:46 PM
When you have remote paging on, RowNumberer resets to 1 when you change page. Pretty sure this wasn't the case in 1.x



<script runat="server">


Private Sub Store1_ReadData(sender As Object, e As Ext.Net.StoreReadDataEventArgs) Handles Store1.ReadData
Dim list = New List(Of NewObj)()

Dim startIndex = e.Page * e.Limit - e.Limit + 1
Dim endIndex = startIndex + e.Limit - 1

For index = startIndex To endIndex
Dim obj = New NewObj()
obj.Name = "Item " + index.ToString()
obj.ID = index
list.Add(obj)
Next


e.Total = 100

Me.Store1.DataSource = list
Me.Store1.DataBind()
End Sub

Class NewObj

Private _ID As Integer
Public Property ID() As Integer
Get
Return _ID
End Get
Set(ByVal value As Integer)
_ID = value
End Set
End Property



Private _Name As String
Public Property Name() As String
Get
Return _Name
End Get
Set(ByVal value As String)
_Name = value
End Set
End Property


End Class
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>Test Page </title>
</head>
<body>

<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" ScriptMode="Debug" Theme="Gray"
DisableViewState="true" />
<ext:Window runat="server" Width="500" Height="500" Layout="FitLayout">
<Items>
<ext:GridPanel ID="GridPanel1" runat="server" Title="ComponentColumn Editor" Width="600"
Height="300">
<Store>
<ext:Store ID="Store1" runat="server" AutoLoad="true" PageSize="25">
<Proxy>
<ext:PageProxy />
</Proxy>
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="Name" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:RowNumbererColumn runat="server">
</ext:RowNumbererColumn>
<ext:Column DataIndex="Name" Text="Name">
</ext:Column>
</Columns>
</ColumnModel>
<BottomBar>
<ext:PagingToolbar ID="PagingToolbar1" runat="server" DisplayInfo="true" DisplayMsg="Displaying employees {0} - {1} of {2}"
EmptyMsg="No employees to display" />
</BottomBar>
</ext:GridPanel>
</Items>
</ext:Window>
</form>
</body>
</html>

jchau
Apr 12, 2013, 6:58 PM
For anyone looking for an override, this shuld work:



// Override rownumberer to show correct numbers when paging
Ext.grid.RowNumberer.override({
renderer: function (value, metaData, record, rowIdx, colIdx, store) {
var rowspan = this.rowspan;
if (rowspan) {
metaData.tdAttr = 'rowspan="' + rowspan + '"';
}


metaData.tdCls = Ext.baseCSSPrefix + 'grid-cell-special';
var options = store.lastOptions;
return ((options && options.start) ? options.start : 0) + rowIdx + 1;
}
});

Baidaly
Apr 13, 2013, 1:06 AM
Hello!

It's a known bug. Thank you for overriding!

We created issue to track: https://github.com/extnet/Ext.NET/issues/204

Daniil
Apr 17, 2013, 4:18 AM
Fixed in the revision #5027. It will go to the upcoming v2.2 release.

We will need to remove the fix when Sencha fixes it itself.

dangerlinto
Nov 27, 2013, 5:53 PM
Fixed in the revision #5027. It will go to the upcoming v2.2 release.

We will need to remove the fix when Sencha fixes it itself.

Was this fixed or was the override not removed? Or perhaps not fully fixed?

The RowNumbererColumn() works fine for the first load of a store, but I've noticed it acting poorly once you reload data into the store via store.loadData().

Baidaly
Nov 27, 2013, 8:19 PM
Was this fixed or was the override not removed? Or perhaps not fully fixed?

The RowNumbererColumn() works fine for the first load of a store, but I've noticed it acting poorly once you reload data into the store via store.loadData().

Sencha has not fixed it yet. We applied our own fix. About the loadData issue, could you provide a sample to reproduce?