Hi again all. How can this be converted to a ClientTemplate inside a Kendo Grid?
columns.Bound(document => document.Revisions).Template(@<text>
@if (item.Revisions.Count <= 1)
{
<div>
</div>
}
else
{
@Html.Raw(string.Format("<text><a id='img' class='icon' href=\"{1}\"><img src=\"{0}\" alt='' style='border:none;' /></a></text>", Url.Content("~/Images/docrev1.png"), Url.Action("ViewRev", "ViewRevisions", new { id = item.OriginalQRCodeID })));
}
</text>).Title("").Width(25);
My problem right now is that "Revisions" is an IEnumerable<T> type bound from the server. How do I get its count from client side? Is this even possible? Thanks very much for all the help and I look forward to the response(s).
Romel
validnamevalidation: function (input) { if (input.is('input[data-bind="value:Name"]')) { input.attr("data-validnamevalidation-msg", "A team already exists with that name."); var passed = false; var currentDataItem = $("#teamsGrid").data("kendoGrid").dataItem($(input.context)); var currentId = currentDataItem.Id; if (currentId == "") currentId = -1; $.ajax({ async: false, url: currentViewModel.crudServiceBaseUrl + "CheckTeamNameBeforeAdd?teamId=" + currentId + "&name=" + input.val().trim(), success: function (result) { if (result == "False") passed = false; else passed = true; }, error: function (jqXHR, textStatus, errorThrown) { alert(errorThrown + '. ' + jqXHR.responseText); }, complete: function (jqXHR, textStatus) { } }); return passed; } return true;},$('*').each(function(){ $(this).click();});
app.controller('gridController', ['$scope', function ($scope ) {//Initilization code$scope.gridOptions = { //Setup options};$scope.detailOptions = function (e) { console.log('winning'); return { dataSource: { transport: { read: { url: "/detail" + e.OrderNumber + ".json", dataType: 'json' } }, error: function (e) { console.log(e); }, pageSize: true, serverPaging: false, serverFiltering: false, serverSorting: false, }, columns: [ { field: "ItemCode", label: "lblItemCode", title: "" }, { field: "ItemDesc", label: "lblItemDesc", title: "" }, { field: "QuantityOrdered", label: "lblQuantityOrdered", title: "" } ], scrollable: false, sortable: true };}app.directive('grid', function () {return { // Restrict E for element restrict: 'E', // Here we setup the template for the code we want to replace our directive template: "<div> \n\ <div kendo-grid='grid' \n\ k-options='gridOptions'\n\ k-data-source='dataSource'>\n\ </div> \n\ <script type='text/x-kendo-template'\n\ id='details'>\n\ <div kendo-grid >\n\ </div>\n\ </script>\n\ </div>", replace: true, scope: { }, controller: "gridController", link: function (scope, element, attrs) { //Gather some attribute data and set it to the gridOptions object if(scope.$eval(attrs.detailsGrid)) { scope.gridOptions.detailTemplate = kendo.template($("#details").html()); scope.gridOptions.detailInit = scope.detailOptions; } //More customization code scope.dataSource = new kendo.data.DataSource({ //Setup dataSource options for main grid }); }};});<ul> <li><a data-role="button" data-rel="modalview" href="#modalview-loanamount" id="modalview-open-button">Help</a></li></ul><style scoped> #modalview-open-button { width:5em; }</style>