Telerik Forums
Kendo UI for jQuery Forum
2 answers
228 views
Hi ... relatively new to webdev ...

I'm trying to populate the treeview from an async remote data source

var tree = $('#treeview').kendoTreeView({   
        dataSource: getQueryData(),
        dataTextField: "Name",
        select: function (e) { 
         var id = this.dataItem(e.node).id;
         onChange(id);
        }

I need to retrieve the data then process it prior to setting the data source in order to add sprites. Thus far my solution is as follows

  function fetchData(cb) {
    var data = [];
    var ds = new kendo.data.DataSource({
      transport: {
        read: {
          url         : "http://localhost:57773/api/definitions",
          dataType    : "json"
        }
      }
    });

    ds.fetch(function () {
      data = cb(ds.data());              
    });      

    return data;
  };

  function addSprites (data) {
    for (var key in data) {
      if (key == "NodeType") {
       data.spriteCssClass = data.NodeType;
      }

      if (data[key] !== null && typeof(data[key])=="object") {
        addSprites(data[key]);
      }
    }
    return data
  };

  function getQueryData () {  

    var dataitems = fetchData(addSprites);
    
    var hds = new kendo.data.HierarchicalDataSource({
      data: dataitems,
      schema: {
        model: {
          id          : "Key",
          hasChildren : "HasChildren"          
        }
      }  
    });

    return hds;
  }; 

I am not quite sure how I should be architecting this since the hierarchical data set is returning prior to the completion of the async data retrieval and pre-processing of that data. I'd be grateful if someone could give me a steer as to how to do this "properly". If possible I'd like to avoid going synchronous.

Thx IA.

Simon
Alex Gyoshev
Telerik team
 answered on 11 Feb 2014
1 answer
253 views
Hi, is there any configuration to prevent Editor from converting Greek characters to html entities? For example, by default Editor converts "ΑΒΓ" to "ΑΒΓ". Any workarounds? BTW, I use the MVC wrapper.
Alex Gyoshev
Telerik team
 answered on 11 Feb 2014
7 answers
177 views
Hi,

I want to create an application that will work on browsers, tablets and smartphones. How do I start? is there anything special that I have to take into consideration from the beginning? I'm asking because I already created a browser application  infrastructure using the templateLoader example that I found in one of your tutorials, and I'm also working with your router and I'm not sure that I'm in the right direction...It looks good on browser but that are the things that I have to think about if I want my app to work on other devices as well?
Sebastian
Telerik team
 answered on 11 Feb 2014
7 answers
893 views
I've been beating this dead horse for the last 2 weeks, on and off and still can't figure it out.

This is my datasource js:

var myDS = new kendo.data.DataSource({
    transport: {
        read: {
            url: 'dataset.json'
            ,dataType: "jsonp"
            ,data: { select: "ID,NAME" }
        }
    },
    schema: {
        data: function(response) {
            return response.features;
        },
        model: {
            fields: {
                "properties.ID": { type: "number" },
                "properties.NAME": { type: "string" }
            },
        }
    }
});

This is my dropdownlist init:

$("#dropdown").kendoComboBox({
    placeholder: "...",
    autoBind: false,
    suggest: true,
    dataTextField: "properties.NAME",
    dataValueField: "properties.ID",
    dataSource: myDS
});

This is my datasource table:

ID  |  NAME
-------------
1   |   0,4
2   |   6
3   |   10
4   |   20
5   |   35
6   |   110
7   |   220
8   |   400

The error 'Object doesn't support property or method 'toLowerCase'' pops up when trying to init the ddl - because my textfield values are basically numbers (but set as string in model and database!!), which are treated as strings - if I check the return values of datasource in Firefox and Chrome i see that my return values are treated as strings. The same goes for IE10 and above, but IE9 and IE8 treat those values as numbers, even if I've set the name field as string in datasource.

I've tried everything, I even went through all of the return rows of dataset and converted all of the name values to string, but that didn't help either. Not only that - if i try to print the response.features to console i get undefined in ie8/ie9 (what?).

Can anyone help me?
Atanas Korchev
Telerik team
 answered on 11 Feb 2014
2 answers
175 views
Hi, im evaluating the Kendo Mobile UI with application framework to develop a hybrid app for Android and IOS.

Im using application Framework, separating classes using .js files.

The problem is that visual studio 2013 intellisense doesnt provide any help for class constructor (for example when i wrote new User() intellisense dont suggest the constructor parameters defined).

any idea?

/*
User = kendo.data.ObservableObject.extend({
    init: function(username,nombre,apellido,email){
        this.username = username;
    }
});
*/

EXAMPLE FILES:

app.js

var app = new kendo.mobile.Application($(document.body), {
    user : null,
    loginService: null,
    skin:'flat',
    transition: 'slide',
    initial :  "views/account/login.html",
    init: function () {
        this.loginService = new LoginService();
        if (this.loginService.loadLocalCredential())
            this.initial = 'views/home/index.html';
    }
});

login.js

LoginService = kendo.data.ObservableObject.extend({
    username: "",
    password: "",
    isLoggedIn: false,
    login: function () {
        var that = this;
        var url = 'http://url/Account/Login?username=' + this.username + '&password=' + this.password;
        $.ajax({
            url: url,
            dataType: "json",
            success: function (data, textStatus, jqXHR) {
                if (data.result == true) {
                          var user = new User(username,nombre,apellido,email); /* when i write new User() intellisense doesnt provide any help*/
                    that.set("isLoggedIn", true);
                    app.navigate("./views/home/index.html");
                }
            }
        });
    },
    logout: function () {
        this.clear();
        app.navigate('./views/home/index.html');
    },
    clear: function () {
        this.set('username', '');
        this.set('password', '');
        this.set('isLoggedIn', false);
    },
    loadLocalCredential: function () {
        this.set('username', 'geoorge');
        this.set('password', '1231');
        this.set('isLoggedIn', true);
         
    }
 
});


user.js

User = kendo.data.ObservableObject.extend({
    username: "",
    nombre: "",
    apellido: "",
    email: "",
    isLoggedIn: false,
    init: function(username,nombre,apellido,email){
        this.username = username; this.nombre = nombre; this.apellido = apellido; this.email = email;
    }
});


Thanks!
Kiril Nikolov
Telerik team
 answered on 11 Feb 2014
1 answer
122 views
Is there a way to block out the slots for an all day event, instead of having the event in the "all day" slot?
Rosen
Telerik team
 answered on 11 Feb 2014
3 answers
617 views
I need to be able to set a fixed width for the labels of the Value Axis.  I have a problem caused by the re-scaling of the plotting area based on the number of digits in the valueAxis labels.  I need some way to keep the actual chart area (compared to the value axis) to stay the same width, so that I can consistently line up with other elements on my page.
 
  I can't seem to find any documentation and 

valueAxis: { 
labels:{ 
width: 100
}, 
width: 100, 
}, 

does not work.  Is this possible?  PlotArea and ChartArea width also seems to have no effect. 

-Thorne

Iliana Dyankova
Telerik team
 answered on 11 Feb 2014
5 answers
252 views
Hello,
I'm using MVVM approach in DropDownList configure. Everything works fine but I unexpectedly stuck on the "data-option-label" attribute value == "[ None ]". This value causes error "SyntaxError: Unexpected token N ". Using '[ .. ]' instead of '( .. )' is very important for our designer, so.. please take a look at jsFiddle example. Thank you.
Kiril Nikolov
Telerik team
 answered on 11 Feb 2014
2 answers
119 views
I have a batch editing grid where the user can add a new row either by clicking the Add button or tabbing off of the last editable column. The Add button works as intended...it adds a new row at the bottom of the grid and puts the keyboard focus in the first column of the new row.

The problem I am having is calling addRow programatically. It creates the new row at the bottom of the grid, but it automatically puts the keyboard focus in the second column of the new row. I want it to behave the same way as pressing the Add button. Here is the script that catches my keypress [TAB], and determines if it is the last row and last column (in my case it's column index 6). 

function onDataBound(e) {
               var grid = $("#VINGrid").data("kendoGrid");
 
               $(grid.tbody).on("keydown", "td", function (e) {
                 
 
                 if (e.keyCode == 9)
                 {
                       var row = $(this).closest("tr");
                       var rowIdx = $("tr", grid.tbody).index(row);
                       var colIdx = $("td", row).index(this);
 
                       var count = grid.dataSource.total();
 
                       if(rowIdx == count-1 && colIdx == 6)
                       {
                           grid.addRow();
                       }
                   }
               });
           }

Any idea why my script is automatically moving it to the second column? 

Thanks,
Jason
Dimiter Madjarov
Telerik team
 answered on 11 Feb 2014
5 answers
1.2K+ views
Is there a way to clear all the tabs?
Thanks in advance.
Kamen Bundev
Telerik team
 answered on 11 Feb 2014
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?