Telerik Forums
Kendo UI for jQuery Forum
5 answers
508 views
In SchedulerCustomerEditor sample related to resources and custom templates... Why do you include a resources section in the scheduler definition, but then not use those in the custom edit template?​ $(function () {
  $("#scheduler").kendoScheduler({
   date: new Date(2013, 5, 13, 0, 0, 0, 0),
   startTime: new Date(2013, 5, 13, 7, 0, 0, 0),
   height: 600,
   editable: {
    //set the template
    template: kendo.template($('#CustomEditorTemplate').html())
   },
   timezone: "Etc/UTC",
   resources: [
   {
    title: "Room",
    field: "RoomID",
    dataTextField: "Text",
    dataValueField: "Value",
    dataColorField: "Color",
   dataSource: [
    { Text: "Meeting Room 101", Value: 1, Color: "#6eb3fa" },
    { Text: "Meeting Room 201", Value: 2, Color: "#f58a8a" }
   ]
    },{
    title: "Attendees",
    field: "Attendees",
    multiple: true,
    dataTextField: "Text",
    dataValueField: "Value",
    dataColorField: "Color",
   dataSource: [
   { Text: "Alex", Value: 1, Color: "#f8a398" },
   { Text: "Bob", Value: 2, Color: "#51a0ed" },
   { Text: "Charlie", Value: 3, Color: "#56ca85" }
   ]
  }
 ],
...
 <script type="text/x-kendo-template" id="CustomEditorTemplate">
 ... other markup ...
  <div data-container-for="RoomID" class="k-edit-field">
   <input id="RoomID" name="RoomID" style="width: 200px" type="text"
    data-bind="value:RoomID"
    data-val="true"
    data-val-number="The field RoomID must be a number."
   data-source='[{"text":"Meeting Room 101","value":1},{"text":"Meeting Room 201","value":2}]'
    data-text-field="text"
    data-value-field="value"
    data-value-primitive="true"
    data-option-label="None"
    data-role="dropdownlist" />
  </div>


In the template, shouldn't the resources be referenced in a way that is similar to the following though in this case the resources[0] reference does not find the resource...

​<div data-container-for="sponsorid" class="k-edit-field">
    <input id="SponsorID" name="SponsorID" style="width: 200px" type="text"
           data-bind="value:SponsorID"
           data-val="true"
           data-val-number="The field SponsorID must be a number."
           data-source=resources[0].dataSource
           data-text-field=resources[0].dataTextField
           data-value-field=resources[0].dataValueField
           data-value-primitive="true"
           data-option-label="*No Sponsor"
           data-role="dropdownlist" />
< /div>

The above not finding resources[0] which is odd because it finds it from the following script:
< div class="k-edit-field" id="resourcesContainer" />
< script>
    jQuery(function() {
        var container = jQuery("#resourcesContainer");
        var resources = jQuery("#scheduler").data("kendoScheduler").resources;

        for( resource = 0; resource<resources.length; resource++)
        {
            if(resources[resource].multiple)
            {
                jQuery(kendo.format('<select data-bind="value: {0}" name="{0}">', resources[resource].field))
                  .appendTo(container)
                  .kendoMultiSelect({
                      dataTextField: resources[resource].dataTextField,
                      dataValueField: resources[resource].dataValueField,
                      dataSource: resources[resource].dataSource,
                      valuePrimitive: resources[resource].valuePrimitive,
                      itemTemplate: kendo.format('<span class="k-scheduler-mark" style="background-color:\#= data.{0}?{0}:"none" \#"></span>\#={1}\#', resources[resource].dataColorField, resources[resource].dataTextField),
                      tagTemplate: kendo.format('<span class="k-scheduler-mark" style="background-color:\#= data.{0}?{0}:"none" \#"></span>\#={1}\#', resources[resource].dataColorField, resources[resource].dataTextField)
                  });

            } else {
                jQuery(kendo.format('<select data-bind="value: {0}" name="{0}">', resources[resource].field))
                 .appendTo(container)
                 .kendoDropDownList({
                     dataTextField: resources[resource].dataTextField,
                     dataValueField: resources[resource].dataValueField,
                     dataSource: resources[resource].dataSource,
                     valuePrimitive: resources[resource].valuePrimitive,
                     optionLabel: "None",
                     template: kendo.format('<span class="k-scheduler-mark" style="background-color:\#= data.{0}?{0}:"none" \#"></span>\#={1}\#', resources[resource].dataColorField, resources[resource].dataTextField)
                 });
            }
        }
})
< /script>
yaron
Top achievements
Rank 1
 answered on 28 Apr 2015
3 answers
313 views
Hi,
I'm trying to bind a custom command using MVVM and having no luck yet. I'm binding the function on the model inside the data-columns attribute, but the function does not fire when I click the command button. instead it displays an jquery error "Uncaught TypeError: undefined is not a function", i've tried also removing the quotation marks from the click command property, because in other thread someone says: "The name should not be surrounded by quotation marks." but it does not seems to work either.

please someone help me!. I also reprodced the errero in jsfiddle here

<div id="grid"
    data-role="grid"
    data-columns="[
        {'field':'column','title':'Content'},   
        {'command':{'text':'Button','click':'openAlert','name':'button'}}
    ]"
    data-bind="source: gridSource"></div>
<script>
var viewModel = kendo.observable({
    openAlert: function(e){
        alert('it Works!');
    },
    gridSource: new kendo.data.DataSource({
        data:[{column:'Row1'},{column:'Row2'}]
    }) 
});
kendo.bind($("#grid"), viewModel);
</script>
Alexander Popov
Telerik team
 answered on 28 Apr 2015
1 answer
156 views

Hello

I have a kendo grid bound to the following kendo template code in MVC.

<script type="text/kendo-tmpl" id="AgencyItemTemplate">
   @Html.Action("MyTemplate", "MyController", new {area = "MyArea"})

</script>

 This actions renders another kendo grid with the following code:

  @(Html.Kendo().Grid<SomeModel>()
        .Name("MyGrid_#=idFromTemplateCaller#")
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("Refresh", "MyController", new { area = "MyArea", idFromTemplateCaller= "#=idFromTemplateCaller#" }))
            .Sort(sort => sort.Add(c => c.CreatedDateTime).Descending())
        )

        .Columns(cols =>

        {
            cols.Bound(a => a.FirstProperty)
                .Width(80)
                .Format("{0:c}");
            cols.Bound(a => a.SecondProperty)
                .Width(80)
        })
        .ToClientTemplate()
    )

This works fine, the way it works is the following. There is a "master grid" which offers the user to see details of each of the records. These details are shown in the grid inside the template, passing the "idFromTemplateCaller" to retrieve the appropiate details for each record. What I want to do is the following: when there are no details, remove the grid and show the following custom element

 <div id="noDetailsFound" style="display: none;">

No details found
</div>

This I would normally achieve by binding a custom event  to the Databound of the grid by adding the following line of code

.Events(e => e.DataBound("myPageNS,myJSEvent"))

 And the event would be defined in the same details grid file as follows:

 <script type="text/javascript">

(function(){

     this.myPageNS = this.myPageNS || {};

    myPageNS.myJSEvent = function(){

        alert("fire databound event");

    }

}());

</script>

 

However, I am unable to write javascript code inside the template file. I guess this is because templates are in fact javascript code, so I cannot call the <script> tag. Can you please help? I need this code to be in the same file as the grid, I now that putting it outside the kendo template might work but I do not want to do it because it wouldnt follow my architecture principles.

 I investigated and saw that I am able to write JS code inside the hash symbol #. However, this doesn't work properly in the IIFE. It fails systematically

Greetings,

Luis.

Luis
Top achievements
Rank 1
 answered on 27 Apr 2015
1 answer
155 views

Hi there!

 I am using the Group Footer Template in the Kendo UI Grid using Angular JS:

groupFooterTemplate: "<input id='PlansTY_SubTotal' type='number' value='#=sum#' ng-model='planChange' ng-change='onPlanChange()'>"

 The onPlanChange() function is not getting fired.

 

Thanks!

Boyan Dimitrov
Telerik team
 answered on 27 Apr 2015
1 answer
1.6K+ views

Hi there,

I am seeking to achieve the same outcome as described in this forum post - changing the default behaviour of the numeric textbox when a min and max value has been supplied. The default behaviour is

  • For a numeric textbox with min =0, max = 100
  • User mistakenly types in 500 instead of 50
  • Control automagically "corrects" this to 100 (this just seems plainly wrong) without informing the user in any way.

I had already tried to implement something similar to the solution mentioned in that forum post - however, it doesn't work (presumably because the controls have been updated since). By the time the validation rule runs, the value has already been adjusted to the maximum value, so the rule always passes.

Can you advise how I can achieve this behaviour? I am using Q3 2014.

Thanks,

 

Paul.

 

Daniel
Telerik team
 answered on 27 Apr 2015
2 answers
244 views

I am trying to utilize a Kendo UI scheduler in an Angular app.  After much frustration and realizing that Kendo UI does not support angular templates properly for the scheduler editor, I'm trying to re-implement the "standard" editor as a Kendo UI template.  This is not my preferred method (I'd rather it work from an Angular template), but from what I've read, I don't have a choice at this time.

I'm using the latest Kendo UI Pro v. 2015.1.408

I need the full template layout and behavior including timezone (not needed right now, but useful), the full editor for repeating tasks, and the resource editor.  I will be adding custom fields to it in certain circumstances.

I found a template for version 2013.3.1119 but this is way out of date, I would think...

http://www.telerik.com/support/code-library/custom-editor

Thanks!

Phil
Top achievements
Rank 1
 answered on 27 Apr 2015
1 answer
188 views

Hi

I took your example of virtual scrolling and added a detail template:

http://dojo.telerik.com/oCiTO

When I scroll to the bottom and expand row 49'999 then the scroll area does not get adjusted - ie. the row 50'000​ is not visible or gets cut.

How can this be fixed? Rerender the grid somehow?

Many thanks

Dimo
Telerik team
 answered on 27 Apr 2015
6 answers
138 views
There appears to be a problem with the k-header class' gradients when used with the DropDownList and ComboBox. The problem appears in those widgets' demos and in a custom DropDownList that I built off the demo. The problem occurs in both Chrome and FireFox.
Sriraksha
Top achievements
Rank 1
 answered on 27 Apr 2015
1 answer
198 views

I'm wondering if it's possible to exclude parent nodes in the treelist when using a filter. For example, let's say we have the following data:

 

Animal: {
    id: 1
    parentId: null
    name: "Animal"
}
 
Dog: {
    id: 2
    parentId: 2
    name: "Dog"
}

 

When I populate a treelist with this data, I filter by the string "dog". What displays is the parent node "Animal" with the child node of "Dog". I'd like to only display the child node "Dog" since it matches my filter. Is this possible or does the parent node always have to be present?

Nikolay Rusev
Telerik team
 answered on 27 Apr 2015
1 answer
106 views
I can call the "select" method to select an event on scheduler, but how to scroll the scheduler to let the event show on screen?
Vladimir Iliev
Telerik team
 answered on 27 Apr 2015
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Drag and Drop
Map
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
Licensing
ScrollView
Switch
TextArea
BulletChart
QRCode
ResponsivePanel
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
TimePicker
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?