[CLOSED] GetRowClass MVC

  1. #1

    [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):
            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]
  2. #2
    Hi @aguidali,

    Please use:
    .GetRowClass(function => function.Fn = "userGridRowClass")
  3. #3
    Thanks,

    it works perfectly! :)

    You can close the thread.

Similar Threads

  1. [CLOSED] How to GetRowClass will work in v2.x
    By jesperhp in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 12, 2014, 11:59 AM
  2. getRowClass - documentation
    By matthew in forum 2.x Help
    Replies: 4
    Last Post: Jul 15, 2013, 12:55 PM
  3. Set GetRowClass in code behind
    By Rupesh in forum 1.x Help
    Replies: 1
    Last Post: Apr 17, 2012, 4:38 PM
  4. rowIndex in GetRowClass - possible?
    By Tbaseflug in forum 1.x Help
    Replies: 2
    Last Post: Sep 23, 2009, 10:25 PM
  5. GridPanel GetRowClass
    By louis in forum 1.x Help
    Replies: 4
    Last Post: Mar 04, 2009, 11:15 AM

Tags for this Thread

Posting Permissions