@(Html.EJ().Grid<object>("Grid")
.Datasource((IEnumerable<object>)ViewBag.dataSource)
.AllowPaging()
.AllowFiltering()
.ClientSideEvents(
d =>
{
d.TemplateRefresh("refreshtemplate");
})
.Columns(col =>
{
. . .. .
col.HeaderText("temp1").Template("<input class='numeric' type='text' />").Add();
col.HeaderText("temp2").Template("<input class='numeric' type='text' />").Add();
col.HeaderText("temp3").Template("<input class='numeric' type='text' />").Add();
})
)
<!--Reference the SignalR library. -->
<script src="~/Scripts/jquery.signalR-2.1.2.js"></script>
<!--Reference the autogenerated SignalR hub script. -->
<script src="~/signalr/hubs"></script>
<script>
function refreshtemplate(args) {
$(args.cell).find(".numeric").ejNumericTextbox({
value: 10,
change: "change"
}).attr("id", args.column.headerText + args.rowIndex);
}
$(function () {
window.signal = $.connection.signalRTestHub;
window.signal.client.modify = function (userIp, action, details) {
$("#" + action).ejNumericTextbox({
value: details.value
});
}
$.connection.hub.start().done(function () {
window.change = function (args) {
window.signal.server.modify($("#userName").text(), this.element.attr("id"), args);
}
});
});
</script> |