Skip to content

Paging is not working #198

@jsuske1985

Description

@jsuske1985

Hello,

I am trying to add paging to my grid, but its not appearing or limiting my results....here is my code:

GridDefinition<DepositLog> def = new GridDefinition<DepositLog>();

            GridColumn<DepositLog> ID = new GridColumn<DepositLog>();
            ID.ColumnName = "ID";
            ID.HeaderText = "ID";
            ID.HtmlEncode = false;
            ID.ValueTemplate = "<input type='text' name='ID' value='{Value}' class='form-control' />";
            ID.ValueExpression = (i, c) => i.id.ToString();
            def.AddColumn(ID);

            GridColumn<DepositLog> PayTo = new GridColumn<DepositLog>();
            PayTo.ColumnName = "PayTo";
            PayTo.HeaderText = "PayTo";
            PayTo.HtmlEncode = false;
            PayTo.ValueTemplate = "<input type='text' name='PayTo' value='{Value}' class='form-control' />";
            PayTo.ValueExpression = (i, c) => i.PayTo.ToString();
            def.AddColumn(PayTo);

            GridColumn<DepositLog> Category = new GridColumn<DepositLog>();
            Category.ColumnName = "Category";
            Category.HeaderText = "Category";
            Category.HtmlEncode = false;
            Category.ValueTemplate = "<input type='text' name='Category' value='{Value}' class='form-control' />";
            Category.ValueExpression = (i, c) => i.Category.ToString();
            def.AddColumn(Category);

            def.Paging = true;
            def.ItemsPerPage = 10;

            def.RetrieveData = (options) =>
            {
                return new QueryResult<DepositLog>()
                {
                    Items = _modelItems,
                    TotalRecords = 0
                };
            };

            try
            {
                MVCGridDefinitionTable.GetDefinition<DepositLog>("DepositLogGrid");
            }
            catch (Exception e)
            {
                MVCGridDefinitionTable.Add("DepositLogGrid", def);
            }

And my view:

@Html.MVCGrid("DepositLogGrid")

What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions