This is a migrated thread and some comments may be shown as answers.

[Solved] Remove Filter issues

1 Answer 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Paul
Top achievements
Rank 1
Paul asked on 07 Jun 2012, 07:24 PM

I ran filters for each of these after choosing another Tab then coming back to this Tab.  Upon clicking a filter or remove filter, the screen refreshes but the data stays the same and the filter criteria remains.

The page has filters for all 7 controls:

1. Id: Numeric filter, filter and remove works.
2. ReviewTypeId: Numeric filter, filter works, remove fails.
3. ReviewTypeName: Text filter, filter and remove work.
4. Description: Numeric filter - varchar data; filter executes against ReviewTypeId data, remove fails.
5. Population: Text filter, filter and remove work.
6. Overread: Bool filter, filter and remove work.
7. Active: Bool filter, filter and remove work.

 

The 2 that fail are numeric (Id is numeric but works).  The Description filter affects the Review Type Id column.  Both seem to be using the same filter.  If I set a filter in one and execute it, then open the other, the criteria is there.

Looking at the code below, I don’t see a lot of room for changing “.filterable()”.

Html.Telerik().Grid(Model.ChartDataSets)

    .Name("MyDatasets")

    .Columns(columns =>

    {

        columns.Bound(cds => cds.ChartDataSetId).Width(40).Title(Resources.GRID_ID);

        columns.Bound(cds => cds.ReviewType.ReviewTypeId).Width(100).Title(Resources.GRID_REVIEWTYPE_ID);

        columns.Bound(cds => cds.ReviewType.ReviewTypeName).Width(200).Title(Resources.GRID_REVIEW_TYPE_NAME);

        columns.Bound(cds => cds.ReviewType.ReviewTypeId).Width(230).Title(Resources.GRID_DESCRIPTION).Template(

             @<text>

             @Html.ActionLink(item.Description, "Edit", ControllerNames.CHART_DATASET, new { id = @item.ChartDataSetId }, new { })                          

             </text>

         );

        columns.Bound(cds => cds.Population).Width(160).Title(Resources.GRID_POPULATION);

        columns.Bound(cds => cds.IsOverread).Width(80).Title(Resources.GRID_IS_OVERREAD).Template(row => DisplayStatusTemplate(row.IsOverread));

        columns.Bound(cds => cds.IsActive).Width(60).Title(Resources.GRID_ACTIVE).Template(row => DisplayStatusTemplate(row.IsActive));

       

    }

    )

     .DataKeys(keys => keys.Add(cds => cds.MyDataSetId))

     .Scrollable()

     .Sortable()

     .Scrollable(c => c.Height("400px"))

     .Filterable()    

     .HtmlAttributes(new { @class = "ListGrid" } )

     .Footer(true)

     .Pageable(paging => paging

                .PageSize(10)

                .Position(GridPagerPosition.Bottom)

                .Style(GridPagerStyles.NextPreviousAndNumeric)

                )

      .Render();

1 Answer, 1 is accepted

Sort by
0
Paul
Top achievements
Rank 1
answered on 08 Jun 2012, 02:28 PM
Solved.  

One of the columns was calling the wrong data.

The problem was discovered because the "remove" filter button was failing but that was actually a side effect of the columns being wrong.  Once the columns were pointing correctly, the remove filters worked.

Wrong:
columns.Bound(cds => cds.ReviewType.ReviewTypeId).Width(230).Title(Resources.GRID_DESCRIPTION) 

Right:
columns.Bound(cds => cds.Description).Width(230).Title(Resources.GRID_DESCRIPTION) 
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Paul
Top achievements
Rank 1
Share this question
or