Dynamic size of grid

2 posts, 0 answers
  1. Ric
    Ric avatar
    5 posts
    Member since:
    Sep 2015

    Posted 15 Sep 2015 Link to this post

    I have the following grid

    <div class="actualGrid" id="actualGrid">
            .Columns(columns =>
                columns.Bound(p => p.name).Title("Bench").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains"))).Width(125);
                columns.Bound(p => p.freeSeats).Title("Free Seats").Width(350);
                columns.Command(command => { command.Custom("checkBench1 ").Text(" AM ").Click("doCheckIn"); command.Custom("checkBench 2").Text(" PM ").Click("doCheckIn"); command.Custom("checkBench3").Text("All Day").Click("doCheckIn"); }).Width(250).Title("Check in");
            //.Editable(editable => editable.Mode(GridEditMode.PopUp))
                    .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
            .HtmlAttributes(new { style = "height:530px;" })
                    .Events(events => events.DataBound("onDataBound"))
            .DataSource(dataSource => dataSource
            .Events(events => events.Error("error_handler"))
            .Model(model => model.Id(p => p.id))
                            .Read(read => read.Action("GetBenches", "Home"))

     I would like to know if there is a way to change the size of the grid according to the number of results i have when i use filter

    for Example if i filter first column and get 1 result grid would be small, and if i had 10 results i would be larger.

  2. Radoslav
    Radoslav avatar
    1564 posts

    Posted 17 Sep 2015 Link to this post

    Hi Ric,

    Thank you for contacting us.

    If you remove the scrolling and the height of the grid set in the HtmlAttributes options:
    .HtmlAttributes(new { style = "height:530px;" })
    the grid will have height which is the sum of wall rows height. On the following link you can check a simple example which demonstrates this.

    Also you can check following forum thread which elaborates on the dynamic grid height:

    I hope this helps.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET AJAX banner
Back to Top