@(Html.EJ().Grid<EmployeeView>("Grid")
.....
.ShowSummary()
.SummaryRow(row =>
{
row.Title("Maximum").SummaryColumns(col => { col.SummaryType(SummaryType.Maximum).DisplayColumn("EmployeeID").DataMember("EmployeeID").Add(); }).Add();
})
) |
@(Html.EJ().Grid<EmployeeView>("Grid")
.....
.ClientSideEvents(eve => { eve.ToolbarClick("click"); })
)
<script>
function click(args) {
args.model.columns[1].defaultValue = ej.max(args.model.dataSource, "EmployeeID").EmployeeID + 1;
}
</script> |
<ej-grid id="Grid" datasource=ViewBag.parent query-cell-info="info">
.....
</ej-grid>
<script>
function info(args) {
console.log(args.cell);
//place your code here...
}
</script> |
export class Default extends SampleBase {
load(args) {
isInitialLoad = true;
}
dataBound(args) {
if (isInitialLoad) {
isInitialLoad = false;
var gridCol = []
this.grid.columns.map(function (cols, index) {
if (index % 2 == 0) {
//based on your condition define the column in grid model
gridCol.push({ field: cols.field, width: 90 })
}
})
this.grid.columns = gridCol; // Provide dynamically created columns to Grid
this.grid.refreshColumns();
}
}
render() {
return (<div className='control-pane'>
<div className='control-section'>
<GridComponent load={this.load.bind(this)} dataBound={this.dataBound.bind(this)} ref={g => this.grid = g} dataSource={orderDetails} height='350'>
</GridComponent>
</div>
</div>);
}
}
render(<Default />, document.getElementById('sample')); |