May 26, 2016, 1:37 PM
Grid Cls property is null
I'm having some unexpected behaviour setting the Cls property of a grid.
Using Razor
I've added in the following work-around
Thanks
Using Razor
X.GridPanel()
.ItemID( "Treatments" )
.Cls( "Localize" )
.Title( "People" )
.ColumnWidth( 1 )
.AutoScroll( true )
.Border( false )
.Store(
X.StoreFor<List<myModels.People>>()
.RemotePaging( false )
.AutoLoad( true )
.PageSize( Model.People.Count )
.DataSource( Model.People )
.Reader( reader =>
reader.Add( X.JsonReader() )
)
)
.ColumnModel(
X.Column().Text( "First" ).DataIndex( "FirstName" ).Flex( 1 ).Editor(
X.TextField()
),
X.Column().Text( "Last" ).DataIndex( "LastName" ).Flex( 1 ).Editor(
X.TextField()
),
X.DateColumn().Text( "DOB" ).DataIndex( "DateOfBirth" ).Format( "F d, Y" ).Flex( 1 ).Editor(
X.DateField()
)
)
.SelectionModel(
X.RowSelectionModel().Mode( SelectionMode.Multi )
)
.Plugins(
X.CellEditing()
.ClicksToEdit( 1 ) )
.View(
X.GridView()
.DeferEmptyText( false )
.StripeRows( true )
.TrackOver( true )
.PreserveScrollOnRefresh( true )
.EmptyText( String.Empty )
)
This should set the cls property of the GridPanel to 'Localize', and does add the 'Localize' class to the html, but the cls property of the gridpanel in ext is set to null - so for example Ext.ComponentQuery.query('[cls~=Localize]')
does not return this gridI've added in the following work-around
.Listeners(
l =>
{
l.BeforeRender.Handler = "this.cls= 'Localize';";
}
)
but I feel like this seems to be a bug that this property is not set. I also note that the .addCls() method on grid doesn't seem to work either, so it may in fact be a bug in extJs.Thanks