Sep 11, 2014, 8:45 AM
[CLOSED] GetRowClass MVC
Hi Guys,
I can't figure out how to style the row of a gridpanel.
Controller code (add the view to the current page):
This is the code of the view (added from the action above):
Thanks
Best regard
I can't figure out how to style the row of a gridpanel.
Controller code (add the view to the current page):
public Ext.Net.MVC.PartialViewResult UserManagement()
{
return new Ext.Net.MVC.PartialViewResult
{
RenderMode = RenderMode.AddTo,
ContainerId = "CenterPanel",
ClearContainer = true
};
}
This is the code of the view (added from the action above):
@(Html.X().GridPanel()
.View(
Html.X().GridView()
.LoadingText("Caricamento...")
.GetRowClass(???)
)
.Title("Lista utenti")
.Header(true)
.ID("grid-accounts")
.ColumnLines(true)
.Draggable(false)
.EnableColumnHide(false)
.EnableColumnMove(false)
.EnableColumnResize(false)
.Flex(1)
.Store(
Html.X().Store()
.ID("StoreUsers")
.Model(Html.X().Model()
.Fields(
new ModelField("Id", ModelFieldType.Int),
new ModelField("strLastname", ModelFieldType.String),
new ModelField("strFirstname", ModelFieldType.String),
new ModelField("strUsername", ModelFieldType.String),
new ModelField("strEmail", ModelFieldType.String),
new ModelField("dtFirstAccess", ModelFieldType.Date),
new ModelField("dtLastAccess", ModelFieldType.Date),
new ModelField("strLastLoginIp", ModelFieldType.String),
new ModelField("strPhoneNumber", ModelFieldType.String),
new ModelField("strCelNumber", ModelFieldType.String),
new ModelField("dtValidFrom", ModelFieldType.Date),
new ModelField("dtValidTo", ModelFieldType.Date),
new ModelField("bIsSystemUser", ModelFieldType.Boolean),
new ModelField("bIsAdmin", ModelFieldType.Boolean)
)
)
.Proxy(
Html.X().AjaxProxy()
.Url(Url.Action("GetUsers", "Admin"))
.Reader(Html.X().JsonReader().Root("data"))
)
.PageSize(15)
)
.ColumnModel(column =>
{
column.Add(
Html.X().Column()
.DataIndex("strLastname")
.Flex(1)
.Sortable(true)
.Text("Cognome"));
column.Add(
Html.X().Column()
.DataIndex("strFirstname")
.Flex(1)
.Sortable(true)
.Text("Nome"));
column.Add(
Html.X().Column()
.DataIndex("strUsername")
.Flex(1)
.Sortable(true)
.Text("Nome utente"));
column.Add(
Html.X().Column()
.DataIndex("strEmail")
.Flex(1)
.Sortable(true)
.Text("Email"));
column.Add(
Html.X().DateColumn()
.DataIndex("dtLastAccess")
.Flex(1)
.Sortable(false)
.Width(75)
.Text("Ultimo accesso")
.Format(format)
.Align(Alignment.Center)
);
column.Add(
Html.X().Column()
.DataIndex("strLastLoginIp")
.Sortable(false)
.Text("Ultimo ip"));
column.Add(
Html.X().Column()
.DataIndex("strPhoneNumber")
.Sortable(false)
.Text("Telefono"));
column.Add(
Html.X().Column()
.DataIndex("strCelNumber")
.Sortable(false)
.Text("Cellulare"));
column.Add(
Html.X().Column()
.Sortable(false)
.DataIndex("bIsSystemUser")
.Align(Alignment.Center)
.Width(80)
.Text("Di sistema")
.Renderer("rend(record.data)")
);
column.Add(
Html.X().Column()
.Sortable(false)
.DataIndex("bIsAdmin")
.Align(Alignment.Center)
.Width(90)
.Text("Amministratore")
.Renderer("rend")
);
}
)
.SelectionModel(
Html.X().RowSelectionModel()
.Mode(SelectionMode.Single))
.TopBar(
Html.X().Toolbar()
.Height(35)
.Items(
Html.X().Button()
.Text("Aggiungi utente")
.Icon(Icon.Add)
.Height(30)
.DirectEvents(de =>
{
de.Click.Url = Url.Action("UserAdd", "Admin");
}),
Html.X().Button()
.Text("Modifica")
.Icon(Icon.UserEdit)
.Height(30)
.DirectEvents(de =>
{
de.Click.Url = Url.Action("UserEdit", "Admin");
de.Click.Before = "Hsi.accountModule().OpenEditWindow(el, type, action, extraParams, o);";
}),
Html.X().Button()
.Text("Cancella")
.Icon(Icon.UserDelete)
.Height(30)
.Handler("Hsi.accountModule().DeleteUser()"),
Html.X().Button()
.Text("Definizione azioni")
.Icon(Icon.Cog)
.Height(30)
.DirectEvents(de =>
{
de.Click.Url = Url.Action("RoleManagement", "Admin");
de.Click.Before = "return Hsi.accountModule().RoleUser(el, type, action, extraParams, o);";
}),
Html.X().Button()
.Text("Anteprima")
.Icon(Icon.PageWhiteAcrobat)
.Height(30)
)
)
.BottomBar(
Html.X().PagingToolbar()
.ID("pagingtoolbar")
.DisplayInfo(true)
.DisplayMsg("Utenti {0} - {1} su {2}")
.EmptyMsg("Nessun utente")
)
This is the javascript for styling:var userGridRowClass = function () {
return "admin-row";
};
This is the CSS:.admin-row .x-grid-td {
background: #FFFFAA !important;
}
I've done a lot of test (client debugging) but the javascript is not called; which is the correct configuration for the .GetRowClass() method?Thanks
Best regard
Last edited by Daniil; Sep 12, 2014 at 6:58 AM.
Reason: [CLOSED]