joeharrison714 / MVCGrid.Net

http://mvcgrid.net
MIT License
74 stars 55 forks source link

Need scrollbar for my grid #85

Open VivekMohit opened 7 years ago

VivekMohit commented 7 years ago

I am using MVCGrid in our project. There is a requirement wherein we want to have scroll bars in the grid when the number of items exceed 4 rows. Also there should only be 4 records displayed in the grid at a time. Please let me know a simple way to implement this. If there are more than 4 rows, then only the scroll bar should appear.

Following is the grid default set. But that is not working for me.

GridDefaults gridDefAccSrvcHist = new GridDefaults() { Paging = false, ItemsPerPage = 4, Sorting = true, NoResultsMessage = "Sorry, no results were found" };

MVCGridDefinitionTable.Add("State", new MVCGridBuilder(gridDefAccSrvcHist) .AddColumns(cols => { // Add your columns here cols.Add("NEW_VALUE").WithHeaderText("New Val") .WithValueExpression(i => i.NEW_VALUE) .WithFiltering(true) .WithVisibility(true);

                cols.Add("DTTM").WithHeaderText("Date")
                    .WithValueExpression(i => i.DTTM_DATA_EVENT)
                    .WithFiltering(true)
                   .WithVisibility(true);

                cols.Add("UPDATED_BY_USER").WithHeaderText("Changed By")
                    .WithValueExpression(i => i.UPDATED_BY_USER)
                    .WithFiltering(true)
                   .WithVisibility(true);
            })
            .WithSorting(true, "DTTM")
            .WithRetrieveDataMethod((context) =>
            {
                return new QueryResult<EventHistModel>()
                {
                    Items = objAccSrvcHist.ALL_EVENT_HIST,
                    TotalRecords = objAccSrvcHist.ALL_EVENT_HIST.Count
                };
            })
            );

Any help will be highly appreciable.

joeharrison714 commented 7 years ago

Sorry I have not tried adding scrollbars to the grid. If you are able to do it please post how you did it! Thanks, Joe