function getFormat (val,name) { if (val> 10) { return name; } else { return "<div style='background:red'> "+ name +" </div>" } }Hi,
when using angular syntax inside chart template it is getting displayed as string. Sample
$scope.text = "hi"; $scope.valueAxisConfig = { labels: { template: '{{text}}#= kendo.toString(value, \'c0\') #' } }
Hi,
we are refactoring a rather big ViewModel in order to make it more maintainable and we are splitting it in smaller objects but we are running in some problems of context when dealing with bound events in the UI.
Here is a bare example of our current situation.
With a binding like this:
<button data-bind="click: person.personMethod">personMethod</button>we have this ViewModel (it is TypeScript 1.8 compiled to ES5):
/// <reference path="jquery.d.ts" />/// <reference path="kendo.all.d.ts" />class Person extends kendo.data.ObservableObject { public personName = "John Doe"; private age = 65; constructor() { super(); super.init(this); } public personMethod(e) { alert(this.personName); /* NOT POSSIBLE as 'this' is the ROOT VIEWMODEL */ alert(e.data.personName); /* NOT POSSIBLE as 'e.data' is the ROOT VIEWMODEL */ /* How to reference 'personName'? */ /* this is the hack that I am using now */ const that = (this instanceof ViewModel) ? (<ViewModel><any>this).person : this; /* but it is ugly and it does not permit to access private properties */ alert(that.age); /* NOT POSSIBLE BECAUSE IS PRIVATE */ }}class ViewModel extends kendo.data.ObservableObject { public person = new Person(); constructor() { super(); super.init(this); }}I have written the issues into the comments.
What are your thought on this approach? Is there a recommended way to deal with big ViewModels?
Thanks.
I tried to change the slider's drag handle with the following CSS entry - as it was proposed in the forum:
.k-slider .k-draghandle {
background-color: rgb(242, 179, 0);
width: 20px;
height: 20px;
top: -8px;
left: -8px;
}
The color is changed indeed. But when I start to drag it turns white.
Is there a way to avoid this?
Hello
I implemented a kendo grid with subgrid on row expansion.
On the grid and subgrids with numeric values :
The purpose is to update the UI without calling a service.
To update values in calculated columns, I set dataItems. The problem is that it renders the main grid and then the subgrids and I lose modifications I made on the subgrids... I'm not sure if there's something I can do, so if someone has an idea...
Note:
See the illustration (fake data) :
01.// custom editor on an editable cell.02.column.editor = (container: JQuery, options: kendo.ui.GridColumnEditorOptions): void => {03. [...]04. 05.let element = $('<input type="text" />')06. .appendTo(container)07. .kendoNumericTextBox({08. change: (e) => {09. [...]10. 11. // updates the dataItem of the edited row.12. let model = grid.dataItem(row);13. model.set(options.field, e.sender.value());14. 15. this.calculateFields([...]);16. },17. value: options.model.get(options.field),18. format: '{0:n2}',19. min: 020. });21. 22. [...]23.};24. 25. 26.private calculateFields([...]) {27. 28. [...]29. 30. let mainDataItem = mainGrid.dataSource.getByUid(mainUid);31. let subDataItems = subGrid.dataSource.data();32. 33. // the main grid is refreshed and all edited values the subgrid are lost...34. mainDataItem.set('main-field1', 0);35. mainDataItem.set('main-field2', 0);36. 37. subDataItems38. .forEach(item => {39. let o = item as kendo.data.Model;40. 41. // edited values are already lost, so it's useless...42. o.set('sub-field11', 43. 100 * o.get('sub-field10') / mainDataItem.get('vot'));44. o.set('sub-field21', 45. 100 * o.get('sub-field20') / mainDataItem.get('div'));46. 47. // refreshes the main grid again !48. mainDataItem.set('main-field1', 49. mainDataItem.get('main-field1') + o.get('sub-field11'));50. mainDataItem.set('main-field2', 51. mainDataItem.get('main-field2') + o.get('sub-field21'));52. });53.}
Using angularjs and json data source served by php
http://dojo.telerik.com/UrOzi
I'm trying to edit the row colour of the "parent" grid's k-master-row. This normally succeeds e.g.when expanding the row, but after editing this row and cancel event things look strange:
- in my project after cancel the row where style was changed gets back to regular styling. I'm able to change other $('#.k-master-row')s , but not the key one which I want (the one that was being edited)
- I created a jsfiddle to replicate this, but here I'm experiencing a different issue. The grid after cancel event wraps back again . None of the k-master-rows are applied with the desired style.
https://jsfiddle.net/Turo/t1ctzndu/4/

When I programmatically change a grid it sends a POST with JSON for every field currently on the screen to the root of my REST web service.
This grid is not editable and there's no reason for it to ever send POST, PUT, PATCH, etc. There's nothing to insert or update.
How do I disable this feature?