PDA

View Full Version : [CLOSED] Colouring rows in a gridpanel in a Partial View Result



gets_gui
Mar 18, 2013, 5:52 PM
Dear Ext.Net,

I am using a gridpanel in a Partial View Result,

I want to call a javascript function when each row is rendered, passing the script the record EG applyClass(record),

such that i can apply a class based on values of the record.

I saw mention of the GetRowClass property of the gridview which is set to a javascript function,

but it is not evident how to set the grid view for a grid panel and call the GetRowclass property in razor.

Baidaly
Mar 18, 2013, 8:59 PM
Hello!

Please, read the following thread: http://forums.ext.net/showthread.php?23242

gets_gui
Mar 18, 2013, 9:08 PM
Do you have example for the Razor view?

Thanks,

Baidaly
Mar 18, 2013, 9:26 PM
We don't have an example for GetAdditionalData, but markup should be following:



@(Html.X().GridPanel()
.Features(Html.X().RowBody()
.GetAdditionalData("orig.itemCls='testCls'; orig.itemClasses.push('testCls');")
)
)

gets_gui
Mar 19, 2013, 5:19 PM

Vladimir
Mar 19, 2013, 5:26 PM
If you need apply row css class is depended from a record then you can easly use GetRowClass like in the following sample
http://examples2.ext.net/#/GridPanel/Miscellaneous/Marking_Records/

Razor syntax looks like


Html.X().GridPanel()
.View(
Html.X().GridView()
.GetRowClass(fn=> fn.Fn="getRowClass")
)

gets_gui
Mar 19, 2013, 5:55 PM
It works, thank you!

Daniil
Mar 20, 2013, 5:45 AM
Hi @gets_gui,

Please do not forget to wrap the code in [CODE] tags.