Lets say I have a ViewModel (pseudo code):
MyViewModel​: ObservableObject {
myItems: ObservableArray<MyItemViewModel>
}
MyItemViewModel: ObservableObject {
myFunction: function() {
// Some code here...
}
}
Then, if I make an instance of MyViewModel the dataSource of Kendo Grid, what would the syntax for mapping each row's custom command to myFunction be? I can (as in examples) map to inline function that will then find nearest tr and it's dataItem, then call the function - but I would rather like it (if possible) to map it directly to the function of each row's ViewModel... Any ideas?
Thanks in advance.
I am trying to use the ListView edit mode with AngularJS. In the code snippet below, everything works with the exception of Cancel. Add, Edit, Delete, and Update are all fine. Cancel, however does not. When you hit cancel it accepts the current value in the edit box rather than revering it back to what it was before the edit.
<div kendo-list-view="urlList" k-data-source="dataItem.OsmParams" k-on-save="urlList.refresh()" k-editable="true" style="height:300px; width:100%; min-width:490px;"> <div k-template style="display:flex; flex-direction: row; align-items:center; margin:5px;"> <div style="display:inline-block;width:410px;word-wrap: break-word">{{ dataItem.Url }}</div> <a class="k-button k-button-icontext k-edit-button kendo-command-notext"><span class="k-icon k-edit"></span></a> <a class="k-button k-button-icontext k-delete-button kendo-command-notext"><span class="k-icon k-delete"></span></a> </div> <div k-edit-template style="display:flex; flex-direction: row; align-items:center; margin:5px;"> <input style="width:410px;" type="text" class="k-textbox" name="Url" required="required" validationMessage="required" /> <a class="k-button k-button-icontext k-update-button kendo-command-notext"><span class="k-icon k-update"></span></a> <a class="k-button k-button-icontext k-cancel-button kendo-command-notext"><span class="k-icon k-cancel"></span></a> </div></div><div style="width:100%; text-align: center"> <a style="margin-top: 5px;" class="k-button k-button-icontext k-add-button" ng-click="urlList.add()"><span class="k-icon k-add"></span>Add URL</a></div>Hi, I am trying to create a cascading MultiSelect, but I can't seem to get it right.
I have the following two multiselects and the piece of javascript that refreshes the data. I get the value of #MultiSelect1, but it never passes through to the Action2 Json method, the parameter is ALWAYS null?
<div class="col-lg-2"> <label>Multi1</label></div><div class="col-lg-10"> @(Html.Kendo().MultiSelectFor(m => m.MultiSelect1) .DataSource(s => { s.Read(r => { r.Action("Action1", "Report"); }).ServerFiltering(true); }) .DataTextField("Name") .DataValueField("Id") .HtmlAttributes(new { style = "width:300px" }) .Events(evt => {evt.Change("onChange"); }) ) </div> <div class="col-lg-2"> <label>Multi2</label></div><div class="col-lg-10"> @(Html.Kendo().MultiSelectFor(m => m.MultiSelect2) .DataSource(s => { s.Read(r => { r.Action("Action2", "Report").Data("getList"); }).ServerFiltering(true); }) .DataTextField("Name") .DataValueField("Id") .AutoBind(false) .HtmlAttributes(new { style = "width:300px" }) )</div><script type="text/javascript"> function getList() { var list = $("#MultiSelect1").val(); return { idList:list } }</script>Controller:
public JsonResult Action2(List<string> idList){ . }What am I missing? I have tried playing around with the object type of idList string[] etc.
Thank you.
Hello. I am trying to bind a an object with an array of objects to a kendo.data.DataSource. The array of objects will be for a dropdownlist and everything else outside of the array will be for other fields on the form. Is there a way to do this? I know that if I just had an array of objects I could easily bind the dropdownlist to that DataSource, but is it possible to do it with an object with a list (array) of objects? Below is my code.
HTML MARKUP
<input data-role='dropdownlist'data-option-label='-- Select One --'data-auto-bind='true' data-text-field='ServingPeriod' data-value-field='AdmServingPeriodId' data-primitive-value='true' data-bind='value: SelectedItem, source: DailyEntries' />{ extra: true, operators: { string: { eq: "Is equal to", neq: "Is not equal to", startswith: "Starts with", contains: "Contains", endswith: "Ends with", blank:"Is blank", notblank:"Is not blank" }, number: { eq: "Is equal to", neq: "Is not equal to", gte: "Is greater than or equal to", gt: "Is greater than", lte: "Is less than or equal to", lt: "Is less than", blank:"Is blank", notblank:"Is not blank" }, date: { eq: "Is equal to", neq: "Is not equal to", gte: "Is after or equal to", gt: "Is after", lte: "Is before or equal to", lt: "Is before", blank: "Is blank", notblank: "Is not blank" } }}Hi, I have a grid that I recently upgraded from old Telerik MVC Extensions.
before, the user could select, copy and paste to excel and the styles were keep in Excel.
Now, I'm adding a button to Export to Excel, but styling is not exported.
Is there a way to do that?
@(Html.Kendo().Grid<ShowNumber>().Name("GridNumber").ToolBar(bar => bar.Excel().Text(Shared.buttonExportExcel)).DataSource(ds => ds.Ajax().Read(read => read.Action("ReadNumber", "QueryNumbers").Data("getFilter")) ​
.Columns(columns =>{columns.Bound(c => c.Description);columns.Bound(c => c.Initial);columns.Bound(c => c.Final);}).Events(ev => ev.DataBound("volumeDataBound")))and this is my javascript for changing styles:
function volumeDataBound(e){ var grid = this; var currentRecords = grid.dataSource.view(); for (var i = 0; i < currentRecords.length; i++) { //currentRecords[i] is the current dataItem var item = currentRecords[i]; if(item.DataCorrida==null || item.DataCorrida == '') { var tr = grid.tbody.find("[data-uid='" + item.uid + "']"); tr.find("td.k-hierarchy-cell .k-icon").removeClass(); } if (item.IsShipped) { grid.tbody.find("tr[data-uid='" + item.uid + "']").addClass("shipped-row"); } else if(item.IsRemoved){ grid.tbody.find("tr[data-uid='" + item.uid + "']").addClass("removed-row"); } else{ grid.tbody.find("tr[data-uid='" + item.uid + "']").addClass("regular-row"); } }}Also, I'm not sure if this is the best way to change styles.
Hello ,
What is the best practice to attach event handler on the column header of Grid.
I have found following way.
$("th[role='columnheader']"), function () {
// logic
});
Please suggest the data binding way to attach the event handler on the Grid column header.
Best Regards,
Nilesh Padbidri​

