When I try to Pass an ID in the " Store.Load({params: ( " my PAGING starts up with "NaN" as the first page...

  1. #1

    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
    
                <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
    
            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
    
            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"
    Last edited by RonaldR; Jun 21, 2011 at 5:16 PM. Reason: I updated the Code as per sample below, same issue...
  2. #2

    I change adding the Parameter to the Code behind, Grid show 'NaN' on first page when try to do Paging...

    .vb

           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
    
           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();
                }
           }
  3. #3

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

                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 + "}"})

Similar Threads

  1. Replies: 5
    Last Post: Jul 19, 2012, 1:09 PM
  2. Replies: 1
    Last Post: Jun 26, 2012, 12:29 PM
  3. Replies: 4
    Last Post: May 22, 2012, 11:40 AM
  4. Replies: 5
    Last Post: May 02, 2012, 6:37 PM
  5. Replies: 4
    Last Post: Oct 11, 2011, 3:42 AM

Posting Permissions