|
<div>
@{
object size;
int[] pagesizes = { 10, 20, 30 };
size = pagesizes;
}
...
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.dataSource)
.Columns(col =>
{
...
})
...
.PageSettings(page => page.PageSizes(size)).Render()
</div> |
|
<div>
@Html.EJS().Button("refresh").Content("Refresh").Render()
</div>
<div>
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.dataSource)
.Columns(col =>
{
...
})
.AllowFiltering().AllowReordering().AllowSorting().Load("Initialorder").Render()
</div>
<script>
var columnorder;
...
document.getElementById("refresh").addEventListener("click", () => {
var grid = document.getElementById("Grid").ej2_instances[0];
grid.clearFiltering();
grid.clearSorting();
grid.columns = columnorder;
})
function Initialorder(args) {
var obj = document.getElementById('Grid').ej2_instances[0];
columnorder = obj.columns.map(x => x);
}
</script> |
|
<div>
@{
List<object> toolbarItems = new List<object>();
toolbarItems.Add(new { template = "<div><input type='text'></div>" });
}
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.dataSource)
.Columns(col =>
{
...
}).Toolbar(toolbarItems).Render()
</div> |
Hi Renjith,
Thank you everything was very useful. The only thing left would be the error with column freeze feature. Below you will find further information.
I think I found what is
happening here.. I noticed that in all your examples filter feature is not
enabled. In my grid, I’ve got filter feature enabled, and I just disabled it
and frozen columns feature start working fine.
When I debug frozen column
feature and I set the property to 1,2,3,etc and filter settings are enabled,
the execution reaches filter.js file and it is in this line
‘remove(this.parent.getHeaderContent().querySelector('.e-filterbar'));’ where
it fails, querySelector doesn’t find anything for that filterbar class.
However, in your example, when I
set frozen columns property, execution never reaches that file.
My grid's configuration:
.AllowResizing()
//.EnablePersistence()
.AllowSelection()
.AllowExcelExport()
.PageSettings(page => page.PageSize(20).PageSizes(size))
.AllowPaging()
.AllowSorting()
.ShowColumnChooser()
.FilterSettings(fs => fs.Mode(Syncfusion.EJ2.Grids.FilterBarMode.OnEnter).Type(FilterType.FilterBar))
.Toolbar(toolbarItems)
.AllowFiltering()
.AllowGrouping()
.GridLines(GridLine.Both)
.AllowTextWrap()
.TextWrapSettings(text => text.WrapMode(WrapMode.Header))
.AllowReordering()
.RowDataBound("paintRows")
.QueryCellInfo("checkImageForReleases")
.ToolbarClick("toolbarClick")
.ContextMenuItems(contextMenuItems)
.ContextMenuClick("contextMenuClick")
.Render())
Could you try again at your end with this new information?