|
[Template]
<script type="text/x-jsrender" id="template">
{{:field}} - {{:key}}
</script>
Dim gridbuilder = Html.EJ().Grid(Of Object)("SampleGrid")
. . .
gridbuilder.GroupSettings(Sub(group)
group.GroupedColumns(Sub(col) col.Add("ShipCountry"))
group.GroupedColumns(Sub(col) col.Add("EmployeeID"))
group.CaptionFormat("#template")
End Sub)
. . .
gridbuilder.Render() |
Hi there,
Sorry I havent explained myself properly.
The code sample I gave, builds the grid correctly with the grouping applied. However, I have a bit of javascript that formats the grid. Currently the only way to apply the formatting is to remove one of the 2 groupings and add it back in - and what I'd like to do is to have the grid format called automatically instead.
The attached Gridsamples.zip file contains 2 images - No Formatting is how the grid appears after the grid loads, as per the code I gave. With Formatting is the result of removing the CatName group, and adding it back in (which calls the actioncomplete javascript with the 'grouping' request type)
I'd like it to appear as the withfomatting screenshot but without having to manually remove and add the grouping.
If thats possible!
Thanks..
Ross
|
<script type="text/javascript">
function complete(args) {
if (args.requestType == "grouping" || (this.model.groupSettings.groupedColumns.length > 0 && this.initialRender)) {
//To do your formatting code
}
}
</script> |
Thanks for the code, but that event isn't firing. the first time the page loads, the event fires with 'refresh' as the request type, but that's before any data is populated.
How do I trigger that event once the grid populates?
Ross
|
Dim gridbuilder = Html.EJ().Grid(Of CustomerHistDb)("TransactionsGrid")
gridbuilder.Datasource(ViewBag.CustomerHistdb)
gridbuilder.ClientSideEvents(Sub(eve) eve.DataBound("onDataBound"))
. . .
<script type="text/javascript">
function complete(args) {
if (args.requestType == "grouping") {
//To do your formatting code while grouping
}
}
function onDataBound(args) {
//To do your formatting code while initially render the Grid
}
</script> |