Hello Admin,
1) How to set the width of this grid's first column where columns.Template(@<text>....</text>)?
2) How to enable multi checkboxes for the last two columns? As you see code below, it always show "Contains" and "Start With" for all string columns.
Here is the code on the page:
@{
Html.Kendo().Grid(Model)
.Name("grid")
.Columns(columns =>
{
columns.Template(@<text>
@if (ViewBag.IsMyRequest == true)
{
if (item.CompletedFlag == "fully completed" || (item.CompletedFlag == "partially completed" && item.CurrentStatus == "not reviewed"))
{
@Html.ActionLink("View", "Read", "Request", new { item.Id, tab = ViewBag.CurrentTab }, new { @class = "btn btn-default" })
}
else
{
@Html.ActionLink("Update", "Edit", "Request", new { item.Id, tab = ViewBag.CurrentTab }, new { @class = "btn btn-default" })}
}
else if (ViewBag.IsPendingRequest == true)
{
@Html.ActionLink("Approve", "Approve", "Request", new { item.Id, tab = ViewBag.CurrentTab }, new { @class = "btn btn-default" })
}
else if (ViewBag.IsApprovedDenied == true || ViewBag.IsCompleted == true)
{
@Html.ActionLink("View", "Read", "Request", new { item.Id, tab = ViewBag.CurrentTab}, new { @class = "btn btn-default" });
}
</text>);
columns.Bound(request => request.Id).Width(100).Filterable(ftb => ftb.Cell(cell => cell.Template("integerFilter").Operator("eq").ShowOperators(false).InputWidth(70)));
columns.Bound(request => request.Requestor).Encoded(false);
columns.Bound(request => request.RequestDate).Format("{0:MM/dd/yyyy}").Encoded(false).MinScreenWidth(688);
columns.Bound(request => request.ChangeStartDateTime).Format("{0: M/d/yyyy h:mm tt}").Encoded(false).MinScreenWidth(688);
columns.Bound(request => request.ChangeEndDateTime).Format("{0: M/d/yyyy h:mm tt}").Encoded(false).MinScreenWidth(688);
columns.Bound(request => request.RequestSubject).Encoded(false).MinScreenWidth(864);
columns.Bound(request => request.CurrentStatus).Encoded(false).MinScreenWidth(864).Filterable(ftb => ftb.Multi(true).CheckAll(true));
columns.Bound(request => request.CompletedFlag).Encoded(false).MinScreenWidth(864).Filterable(ftb =>ftb.Multi(true).CheckAll(true));
})
.Filterable(filterable => filterable
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.Contains("Contains")
.StartsWith("Starts With "))
.ForNumber(num => num.Clear()
.IsEqualTo("Equal to"))
.ForDate(d => d.Clear())
)
.Mode(GridFilterMode.Row))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.Resizable(resize => resize.Columns(true))
.Selectable()
.Sortable()
.DataSource(dataSource => dataSource
.Server()
.Model(model => model.Id(request => request.Id))
)
.Scrollable(s => s.Enabled(true).Height("auto"))
.ToolBar(toolbar =>
{
toolbar.Template(@<text>
<div class="toolbar">
<label class="category-label" for="category">Requests</label>
@Html.ActionLink("New Request", "New", "Request", null, new { @class = "btn-primary btn" })
</div>
</text>);
})
.Render();
}
<script>
function integerFilter(e) {
e.element.kendoNumericTextBox({
spinners: false,
format: "#",
decimals: 0
});
};
</script>
@section scripts {
}
Thanks in advance for your help!
Anieda