When I try to Pass an ID in the " Store.Load({params: ( " my PAGING starts up with "NaN" as the first page...
Hi,
I'm using Paging and if works fine, the ONLY issue I have is when I try to pass a value in the Parameter in the Store as stated below, the Grid loads up fine, but the Window in the Paging in the bottom of the Grid shows "NaN" for the FIRST Page...
I track down the reason to this:
ProductsStore.load({ params: { productGroupID: 999} });
If I comment these lines out and replace it with ProductsStore.load(); and HARD CODE the value (eg. 999), PAGING WORKS FINE...
.aspx
Code:
<ext:GridPanel ID="gpProductGroup" runat="server" Height="450" StoreID="ProductGroupStore"
TrackMouseOver="true" Title="Manage Product Group Names" StripeRows="true" AutoScroll="true"
DisableSelection="true">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column DataIndex="Description" Header="Product Group Name" Sortable="true" />
<ext:Column Header="Status" DataIndex="Status" Sortable="true">
<Renderer Fn="formatStatus" />
</ext:Column>
<ext:CommandColumn Width="50">
<Commands>
<ext:GridCommand CommandName="Edit" Text="Edit Product Group" Icon="ApplicationEdit" />
</Commands>
</ext:CommandColumn>
<ext:CommandColumn Width="50">
<Commands>
<ext:GridCommand CommandName="Delete" Icon="Delete" Text="Delete this group" />
</Commands>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true" />
</SelectionModel>
<View>
<ext:GridView ID="gvProductGroup" runat="server" ForceFit="true">
</ext:GridView>
</View>
<Listeners>
<Command Fn="commandHandler" />
</Listeners>
</ext:GridPanel>
.Javascript
Code:
var commandHandler = function(cmd, record) {
record = record.data;
if (cmd == "Edit") {
AddProductsToGroupWindow.setTitle('Modify Product Group');
var productGroupIdValue = record.ProductGroupID;
if (productGroupIdValue != "")
{
// Load ProductsStore with Product Groups...
gpProductGroupList.getSelectionModel().clearSelections();
ProductsStore.load({ params: { productGroupID: 999} });
}
PopulateModalData(record.ProductGroupID, record.Description, record.Status);
AddProductsToGroupWindow.show();
}
else if (cmd == "Delete") {
Ext.Msg.confirm("Confirm", "Are you sure you wish to delete this product group?", function(result) {
if (result == "yes") {
Coolite.AjaxMethods.ProductGroup.DeleteProductGroup(record.ProductGroupID, {
success: function(result) {
ProductGroupStore.load();
},
failure: function(result) {
PageManagement.HandleError();
},
eventMask: {
showMask: true,
msg: "Updating Grid..."
}
});
}
});
}
}
.ashx.vb
Code:
Public Overrides Sub ProcessRequest(ByVal context As System.Web.HttpContext)
Dim productGroupId As Integer = context.Request(PRODUCT_GROUP_ID).AsInt(0)
End Sub
This value 999 come through but once again, the first Page in the Grid for Paging says, "NaN"
I change adding the Parameter to the Code behind, Grid show 'NaN' on first page when try to do Paging...
.vb
Code:
Private Sub LoadPage()
' Load Product
ProductsStore.Proxy.Add(New HttpProxy() With {.Method = HttpMethod.GET, _
.Url = Core.Web.ProcessController.ProductGroup.GetAllProductsForProductGroupHandlerUrl() _
})
' Use for Paging...
ProductsStore.AutoLoadParams.Add(New Parameter() With {.Name = Core.Constants.START_PARAM, .Value = "={" + Core.Constants.START_PARAM_NUMBER + "}"})
ProductsStore.AutoLoadParams.Add(New Parameter() With {.Name = Core.Constants.LIMIT_PARAM, .Value = "={" + Core.Constants.LIMIT_PARAM_NUMBER + "}"})
ProductsStore.BaseParams.Add(New Parameter() With {.Name = Core.Constants.PRODUCT_GROUP_ID, .Value = "={" + CStr(999) + "}"})
End Sub
Javascript
Code:
var commandHandler = function(cmd, record) {
record = record.data;
if (cmd == "Edit") {
AddProductsToGroupWindow.setTitle('Modify Product Group');
if (record.ProductGroupID != "") {
// Load ProductsStore with Product Groups...
gpProductGroupList.getSelectionModel().clearSelections();
//ProductsStore.load({ params: { productGroupID: record.ProductGroupID} });
ProductsStore.load();
}
PopulateModalData(record.ProductGroupID, record.Description, record.Status);
AddProductsToGroupWindow.show();
}
}
[SOLVED]: When I try to Pass an ID in the " Store.Load({params: ( " my PAGING starts up with "NaN" as the first page...
I used:
Code:
ProductsStore.BaseParams.Add(New Parameter() With {.Name = Core.Constants.START_PARAM, .Value = "={" + Core.Constants.START_PARAM_NUMBER + "}"})
ProductsStore.BaseParams.Add(New Parameter() With {.Name = Core.Constants.LIMIT_PARAM, .Value = "={" + Core.Constants.LIMIT_PARAM_NUMBER + "}"})