Hello,
I have a grid and I'm disabled the row that has the approved FALSE, but when I check Select All it checks also the disabled row.
(Html.Kendo().Grid<WhereAbouts.ViewModels.LoginUserViewModel>
().
Name("Team")
.Columns
(columns =>
{
columns.Select().Width(50);
//columns.Bound(c=>c.InsertDate);
columns.Bound(c => c.BadgeNumber).ClientFooterTemplate("<button onclick='getCheckedRows()' class='k-button k-button-icontext k-grid'>Approve</button>");
columns.Bound(c => c.FullName);
columns.Bound(c => c.NumberOfHours).Filterable(false);
columns.Bound(c => c.Approved).Filterable(false).Title("Status");
columns.Bound(c => c.ApprovalManagerId).Hidden(true);
columns.Bound(c => c.Id).Title(" ").ClientTemplate("<a role='button' class='k-button k-button-icontext k-grid' href='" + Url.Action("Overtime", "Overtimes") + "?=#=" + @ViewBag.PeriodIdForGrid + "#&loginId=#=Id" + "#" + "&DropDownPeriodWeek=#=" + @ViewBag.PeriodWeekIdForGrid + "#" + "'>View</a>").Filterable(false);
columns.Bound(c => c.Id).Title(" ").ClientTemplate(
"# if (NumberOfHours > 0) { #" +
"<a role='button' class='k-button k-button-icontext k-grid' href='" + Url.Action("Export_Teams_Overtime", "Overtimes") + "/#=Id#?DropDownPeriod=#=" + @ViewBag.PeriodIdForGrid + "#" + "'>Export</a>" +
"# } else { #" +
"<a role='button' disabled class='k-button k-button-icontext k-grid' href='" + Url.Action("Export_Teams_Overtime", "Overtimes") + "/#=Id#?DropDownPeriod=#=" + @ViewBag.PeriodIdForGrid + "#" + "'>Export</a>" +
"# } #").Filterable(false);
columns.Bound(c => c.Id).Title(" ").ClientTemplate("# if (Approved == true ) { #" +
"<a role='button' class='k-button k-button-icontext k-grid' href='" + Url.Action("ApproveTeamOvertime", "Overtimes") + "/#=" + @ViewBag.PeriodIdForGrid + "#?loginId=#=Id" + "#" + "' disabled>Approve</a>" +
"# } else if(ApprovalManagerId ==" + @ViewBag.LoginUserId + "){ #" +
"<a role='button' class='k-button k-button-icontext k-grid' href='" + Url.Action("ApproveTeamOvertime", "Overtimes") + "/#=" + @ViewBag.PeriodIdForGrid + "#?loginId=#=Id" + "#" + "'disabled>Approve</a>" +
"# } else{ #" +
"<a role='button' class='k-button k-button-icontext k-grid' href='" + Url.Action("ApproveTeamOvertime", "Overtimes") + "/#=" + @ViewBag.PeriodIdForGrid + "#?loginId=#=Id" + "#" + "'>Approve</a>" +
"# } #").Filterable(false);
})
.HtmlAttributes(new { style = "height: auto;width:auto" })
.Scrollable()
.Pageable(pageable =>
{
pageable.Refresh(true);
pageable.PageSizes(true);
})
.HtmlAttributes(new { style = "height: auto;width: auto" })
.Scrollable()
.Events(e=>e.DataBound("test"))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(c => c.Id);
})
.Read(read => read.Action("Read_Team_Test", "OverTimes", new { periodId = @ViewBag.PeriodIdForGrid, periodWeekId = @ViewBag.PeriodWeekIdForGrid, tab = 1 }))
)
This is the JS
function test(e) {
var grid = this;
this.tbody.find('tr').each(function () {
var dataItem = grid.dataItem(this);
if (dataItem.Approved === false) {
$(this).addClass('disable-cells');
}
})
}
I would like to select all rows except the disabled one.
Is it posible?
Also, might help if I can disable the Select All from header.
Thank you!