This question is locked. New answers and comments are not allowed.
Currently I am using a Telerik Grid control with paging, sorting, and filtering enabled that renders a grid for attendance and displays checkboxes to mark people as attended.
I am also using the following code to check them off
I am pasing in a IQueryable of my view in the database. Everything works fine, except when I click the checkboxes, and it fires a javascript error and I have to click them again to make the change. And when I lose focus, all that displays is a tiny red tick that the field has changed, the checkbox loses it's checkmark
The updates are pushed to the database properly as well.
In addition, when I try to use
the grid no longer recognizes that as changed and never posts anything back to the database.
I need a grid that can edit a list of attendance with checkboxes. I can either fix the javascript error or figure out how to get the other one to post to the db. On the latter, however, it loses it's ability to sort and filter by attended or not, so I would need to have that functionality as well.
The error that occurs is
and is somewhere in jQuery or Telerik itself, not something I coded.
I am using Telerik MVC extensions Q1.3.15 and unable to update to Q1.4.14 (not in my list of available downloads - possibly unreleased to free users?) but if this update solves the problem I can find a way to download that update.
Just to re-iterate:
Here's what it needs to do:
<%
Html.Telerik().Grid(Model)
.Name("Grid")
.Pageable(paging => paging.PageSize(20).Style(GridPagerStyles.NextPreviousAndNumeric).Position(GridPagerPosition.Bottom))
.Sortable(sorting => sorting.SortMode(GridSortMode.SingleColumn))
.Filterable()
.ToolBar(commands =>
{
commands.SubmitChanges();
})
.DataKeys(keys => keys.Add(o => o.RegistrationID))
.Columns(columns =>
{
columns.Bound(m => m.Attended).Format("<input type='checkbox' name='checkedRows' />").Encoded(false);
//other columns bound here
})
.DataBinding(dataBinding =>
{
dataBinding.Ajax()
.Select("_Attendance", "Home").Enabled(true)
.Update("_SaveAttendance", "Home").Enabled(true);
})
.ClientEvents(events =>
{
events.OnDataBinding("Grid_onDataBinding").OnError("Grid_onError").OnRowDataBound("onRowDataBound");
})
.Editable(editing => editing.Mode(GridEditMode.InCell))
.Scrollable(scrolling => scrolling.Enabled(true).Height(600))
.Render();
%>I am also using the following code to check them off
function onRowDataBound(e) {
var row = e.row;
var dataItem = e.dataItem;
$("input[type='checkbox']", row)
.attr({
'value': dataItem.Attended
});
if (dataItem.Attended) {
$("input[type='checkbox']", row)
.attr({
'checked': dataItem.AttendedCheckHTML //gets "checked" from setter in partial entity
});
}
}
events.OnDataBinding("Grid_onDataBinding").OnError("Grid_onError").OnRowDataBound("onRowDataBound");
})I am pasing in a IQueryable of my view in the database. Everything works fine, except when I click the checkboxes, and it fires a javascript error and I have to click them again to make the change. And when I lose focus, all that displays is a tiny red tick that the field has changed, the checkbox loses it's checkmark
The updates are pushed to the database properly as well.
In addition, when I try to use
columns.Template(o =>
{
%>
<input name="Attended" type="checkbox" value="<%= o.Attended %>"
<% if (o.Attended) {<br>
%> checked="checked" <%<br> } %>
/>
<%
}).Title("").Width(50).ClientTemplate("<input type='checkbox' name='Attended' value='<#= Attended #>' />").Title("").Width(50);the grid no longer recognizes that as changed and never posts anything back to the database.
I need a grid that can edit a list of attendance with checkboxes. I can either fix the javascript error or figure out how to get the other one to post to the db. On the latter, however, it loses it's ability to sort and filter by attended or not, so I would need to have that functionality as well.
The error that occurs is
a is null
(function(a,b){function cg(a){return d...a+"px")}}),a.jQuery=a.$=d})(window)and is somewhere in jQuery or Telerik itself, not something I coded.
I am using Telerik MVC extensions Q1.3.15 and unable to update to Q1.4.14 (not in my list of available downloads - possibly unreleased to free users?) but if this update solves the problem I can find a way to download that update.
Just to re-iterate:
Here's what it needs to do:
- Display information about a user's registration
- Allow the user (an admin) to mark them as attended (default: not attended) in the checkbox - this causes the javascript error
- Filter by user information, or attended
- Allow paging and sorting by user information, or attended