PDA

View Full Version : [CLOSED] Gridpanel vertical scroll Razor



matrixwebtech
Aug 12, 2014, 3:10 PM
How to setup gridpanel vertical scroll?

Daniil
Aug 13, 2014, 8:57 AM
Hi @matrixwebtech,

A vertical scrollbar should appear automatically if there is no enough room for rows. So, please provide a test case.

matrixwebtech
Aug 13, 2014, 9:17 AM
VIEW


@(
Html.X().GridPanel()
.ID("GridPanel1")
.Title("Plants")
.Frame(true)
.Height(300)
.Width(200)
.Scroll(ScrollMode.Both)
.AutoScroll(true)

.Store(
Html.X().Store()
.DataSource( ViewBag.loadgrid)

.PageSize(5)
.Model
(
X.Model()
.Fields
(
X.ModelField().Name("Common").Type(ModelFieldType.String)


)

)
)
.ColumnModel(

Html.X().Column().DataIndex("Common").Text("Common Name").Flex(1)



)
.SelectionModel(
X.CheckboxSelectionModel()
.Mode(SelectionMode.Multi)

)
.Plugins
(
Html.X().FilterHeader()

)

.BottomBar(
Html.X().PagingToolbar()
.DisplayInfo(true)
.DisplayMsg("Displaying plants {0} - {1} of {2}")
.EmptyMsg("No plants to display")
)
)

CONTROLLER


public ActionResult Index()
{
//X.GetCmp<DateField>("dt").SetValue(DateTime.Now.ToString("dd-MM-yyyy"));
ViewBag.loadgrid = dragtrack.Plant.GetPlants();
return View();
}

MODEL



public class dragtrack
{

public class Plant
{
public string Common
{
get;
set;
}





public static List<Plant> GetPlants()
{
return new List<Plant> {
new Plant
{
Common = "Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot Bloodroot ",


},

new Plant
{
Common = "Columbine",


},

new Plant
{
Common = "Marsh Marigold",


},

new Plant
{
Common = "Cowslip",


},

new Plant
{
Common = "Dutchman's-Breeches",


},


};
}
}
}

I set grid property

.Scroll(ScrollMode.Both)
.AutoScroll(true)

but full data not showing in 1st row.for this kind of situation I need a vertical scroll

Daniil
Aug 13, 2014, 1:34 PM
A scrollbar for one row? Well, there is no such the functionality.

It looks the only thing I can suggest is setting up this option for the Column:

.Wrap(true)

matrixwebtech
Aug 13, 2014, 7:43 PM
Thanks for help.its works fine.