Hi all, I would like to use, in my datagrid toolbar an ejs-checkbox to filter data.
I've tried to add a template item to toolbox using :
toolbarItems.Add(new {template = "<ejs-checkbox id='check' label='test' checked='' change='OnChange'></ejs-checkbox>", align = "right" })
without result.
I've solved with :
toolbarItems.Add(new {template = "<input type='checkbox' id='check1' onclick='handleClick(this);'> Show All</input>", align = "right" });
How can i have the same result with ejs-checkbox ?
Thanks in advance
Stefano
|
@{
List<object> toolbarItems = new List<object>();
toolbarItems.Add(new { template = "#menuitem", align = "right" });
}
<div id="menuitem">
<input type="checkbox" class='check'/>
</div>
<ejs-grid id="Grid" created="created" toolbar="toolbarItems" allowFiltering="true" dataSource="@ViewBag.DataSource">
<e-grid-columns>
. . . . . . . .
</ejs-grid>
<script>
function created() {
var checkBoxObj = new ej.buttons.CheckBox({ checked: true, label: 'Show All' });
checkBoxObj.appendTo(".check");
}
</script> |
Hi Thiyagu, your solution works very well. I suggest adding style="display: none;" to the div menuitem so the same is hidden when the page is created and the grid is created and populated.
Thanks
Stefano