Telerik Forums
Kendo UI for jQuery Forum
1 answer
152 views
Hi, I'm setting up a kendoDropTargetArea on a grid like this:

    _setupDropTargets: function() {
      var _this = this;
      this.grid.tbody.kendoDropTargetArea({
        group: 'allocationDetailsGroup',
        filter: this.dropSelector,
        drop: function(e) {
          if (_this._canDrop(e)) {
            return _this._doDrop(e);
          } else  {cancel dragging here}
        }
      });
      return this;
    }

What do I put in "cancel dragging here", so that the draggable floats back to its original position? (right now it disappears).

Tom
 

Alexander Valchev
Telerik team
 answered on 28 Mar 2014
2 answers
537 views
Is it possible to add a grid inside a ClientTemplate for a column?   I would like to have a grid and then for one of the columns in the rows add another grid to it using the datasource.

It is like the example posted: http://demos.telerik.com/kendo-ui/web/grid/rowtemplate.html.  But, I want a grid in the column not the detailed grid example. 


Vladimir Iliev
Telerik team
 answered on 28 Mar 2014
3 answers
69 views
I am using the custom download kendo tool to download a single build of kendo for my projects needs. I will run this on tablets so I want the minimal amount of JavaScript. I'm using Sparklines DataViz and noticed that I have to also download DataViz themes to get them to show in IE 10. I wasn't expecting this because the tool appeared to manage dependencies for me. That is, if I select an item and it depends on other items, kendo automatically selects those other items for me.

Image attached.
T. Tsonev
Telerik team
 answered on 28 Mar 2014
6 answers
413 views
Hi,

This should be a minimal test case for TreeView reading its data from json file. Currently, we are testing it localy, using Internet Information server.
This is how we invoke the page:

http://localhost/cbp/index.html#/bb

In Chrome, F5 does not reload TreeView, Ctrl+F5 does. In Internet Explorer, reload displays TreeView for a fraction of a second and then its erased.

What problems do you see in this source and how should it be resolved?

Thanks,
Ivan
Ivan
Top achievements
Rank 1
 answered on 28 Mar 2014
1 answer
345 views
Hi,
We have angularjs - kendo ui based solution. In the template kendo tree is defined with k-options param set to angular controller variable.
Please see attached :
1. bulletinBoard.tpl.html - template where kendo tree is defined
2. bulletinBoard.js - controller

Inside controller we have defined factory for communication with web api in order to retrieve asynchronously json response.

In the LogConsole.png, I have pasted just for the reference that valid json is returned and unwrapped in the controller by calling .then(function(data)... call.

However tree is not populated with the fetched data.
Please advice what are we doing wrong?

We are new to Angular, Kendo and spent many hours trying to resolve this issue.

Thanks in advance,
Sincerely
Ivan


Ivan
Top achievements
Rank 1
 answered on 28 Mar 2014
1 answer
77 views
Hello,

When I remove an item from an array using splice, as per your examples, it appears that two items are being removed from the array rather than just one.
I've created an example below:

http://trykendoui.telerik.com/iBec

It seems to be caused by using the 'set' command against the array:

viewModel.set('data.files', fileCollection);

Am I using the set command in the wrong way?

Thanks.
Petyo
Telerik team
 answered on 28 Mar 2014
6 answers
274 views

Environment:
VS2010 - MVC4 Web Project
Server 2008 R2
IE 8 / FF 10
Telerik UI for ASP.NET MVC 2014.1 318
jQuery 1.9.0

I am not able to get a reference using the element.data("kendoGrid") syntax.  Every time I hit that code, my variable is undefined.

Can someone please point me to what I'm missing?

Html:

01.<div class="col-md-2">
02.    <div class="panel panel-default">
03.        <div class="panel-heading">Line of Business</div>
04.        <div class="panel-body" id="lobnav"></div>
05.    </div>
06.    <div class="panel panel-default">
07.        <div class="panel-heading">Application</div>
08.        <div class="panel-body" id="lobapp"></div>
09.    </div>
10.    <div class="panel panel-default">
11.        <div class="panel-heading">Filter</div>
12.        <div class="panel-body" id="jobfilter"></div>
13.    </div>
14.</div>
15.<div class="col-md-10">
16.    <div id="jobsgrid"></div>
17.</div>

Code:
​
001.$(document).ready(function () {
002.    function resizeGrid() {
003.        var gridElement = $("#jobsgrid"),
004.            dataArea = gridElement.find(".k-grid-content"),
005.            gridHeight = gridElement.innerHeight(),
006.            otherElements = gridElement.children().not(".k-grid-content"),
007.            otherElementsHeight = 0;
008.        otherElements.each(function () {
009.            otherElementsHeight += $(this).outerHeight();
010.        });
011.        dataArea.height(gridHeight - otherElementsHeight);
012.    };
013. 
014.    function loadApplications(arg) {
015.        $("#lobapp").kendoListView({
016.            selectable: "single",
017.            change: function (e) {
018.                loadJobs(arg, false);
019.            },
020.            template: "<div>${Name}</div>",
021.            dataSource: {
022.                transport: {
023.                    read: {
024.                        url: "/api/App"
025.                    },
026.                    parameterMap: function (options, type) {
027.                        return { 'id': arg };
028.                    }
029.                }
030.            }
031.        });
032.    };
033. 
034.    function filterJobs(arg) {
035.        var jgrid = $("#jobsgrid").data("kendoGrid");
036.        if (arg !== 1) {
037.            jgrid.dataSource.filter({
038.                field: "Status", operator: "eq", value: arg
039.            });
040.        } else {
041.            jgrid.dataSource.filter({});
042.        }
043.    };
044.     
045.    $(window).resize(function () {
046.        resizeGrid();
047.    });
048. 
049.    $("#jobfilter").kendoListView({
050.        selectable: "single",
051.        template: "<div id='filter-${Id}'>${Name}</div>",
052.        dataSource: {
053.            transport: {
054.                read: {
055.                    url: "/api/Theme"
056.                }
057.            }
058.        },
059.        change: function(e) {
060.            var itm = this.select().index(), dataItm = this.dataSource.view()[itm];
061.            filterJobs(dataItm.id);
062.        }
063.    });
064. 
065.    $("#lobnav").kendoTreeView({
066.        select: function (e) {
067.            var tree = this, src = tree.dataItem(e.node);
068.            loadApplications(src.id);
069.            if (src.hasChildren) {
070.                loadJobs(src.id, true);
071.            } else {
072.                loadJobs(src.id, false);
073.            }
074.        },
075.        dataSource: {
076.            transport: {
077.                read: {
078.                    url: "/api/Lob"
079.                }
080.            },
081.            schema: {
082.                model: {
083.                    id: "Id",
084.                    hasChildren: "HasChildren"
085.                }
086.            }
087.        },
088.        loadOnDemand: false,
089.        dataTextField: "Name"
090.    });
091. 
092.    function loadJobs(arg, parent) {
093.        $("#jobsgrid").kendoGrid({
094.            columns: [
095.                {
096.                    field: "owner",
097.                    title: "Application",
098.                    width: "5%"
099.                },
100.                {
101.                    field: "name",
102.                    title: "Process Name",
103.                    width: "18%"
104.                },
105.                {
106.                    field: "prcnt",
107.                    title: "Percent Complete",
108.                    template: "<div class='progress'></div>",
109.                    width: "30%"
110.                },
111.                {
112.                    field: "avgtime",
113.                    title: "Average Time",
114.                    format: "{0:hh:mm:ss}",
115.                    width: "12%"
116.                },
117.                {
118.                    field: "elapsed",
119.                    title: "Elapsed Time",
120.                    format: "{0:hh:mm:ss}",
121.                    width: "12%"
122.                },
123.                {
124.                    field: "dproc",
125.                    title: "Dependent Process",
126.                    width: "5%"
127.                },
128.                {
129.                    field: "status",
130.                    title: "Status"
131.                }
132.            ],
133.            sortable: {
134.                mode: "single",
135.                allowUnsort: true
136.            },
137.            pageable: true,
138.            scrollable: false,
139.            resizable: true,
140.            dataSource: {
141.                transport: {
142.                    read: {
143.                        url: "/api/Process?id=" + arg + "&parent=" + parent
144.                    }
145.                },
146.                schema: {
147.                    data: "Data",
148.                    total: "Count",
149.                    model: { id: "Id" }
150.                },
151.                pageSize: 15,
152.                serverPaging: true,
153.                serverFiltering: true
154.            },
155.            dataBound: function (e) {
156.                var grid = this;
157.                $(".progress").each(function () {
158.                    var row = $(this).closest("tr");
159.                    var model = grid.dataItem(row);
160.                    if (model.prcnt <= 100) {
161.                        $(this).kendoProgressBar({
162.                            value: model.prcnt,
163.                            type: "percent"
164.                        });
165.                    } else {
166.                        $(this).kendoProgressBar({
167.                            value: model.prcnt,
168.                            type: "percent"
169.                        }).html("<span class='k-progress-status-wrap'>" +
170.                            "<span class='k-progress-status'>Overtime</span></span>" +
171.                            "<div class='k-state-selected k-complete' style='width: 100%;'>" +
172.                            "<span class='k-progress-status-wrap overtime' style='width: 100%;'>" +
173.                            "<span class='k-progress-status overtime'>Overtime</span></span></div>");
174.                    }
175.                });
176.            }
177.        });
178.    };
179.});

Alexander Valchev
Telerik team
 answered on 28 Mar 2014
4 answers
544 views
Hello everyone!

I'm new with Phonegap and Kendo!
I look for a solution for several hours and nerver found it, so I need your  precious help!

I  have a listview-link and when I click on an item, I call a function who use "app.navigate" to redirect to an another page, but I want to know if is it possible to send datas to this another page? and how to do that?

Maybe I should use an another solution than app.navigate? 

thank you in advance.





Kiril Nikolov
Telerik team
 answered on 28 Mar 2014
13 answers
605 views

I have a grid I'd like to populate that uses a viewmodel that has a datasource with a REST url that has parameters for filtering the data.  I'm trying to set the url parameters, but I'm unable to get at them from the nested datasource.

How can I make the nestd url dynamically reflect the changes in the parent observable?  My viewmodel is below, and any help is appreciated!

Thanks, Dennis

var viewModel = kendo.observable({
    artistFilter: "",
    titleFilter: "",
    genderFilter: "",
    artistFilterUrl: function () {
        if (this.get("artistFilter") == "") {
            return "";
        }
        return "&artist=" + this.get("artistFilter");
    },
    titleFilterUrl: function () {
        if (this.get("titleFilter") == "") {
            return "";
        }
        return "&title=" + this.get("titleFilter");
    },
    Url: function () {
        return this.get("baseUrl") + this.artistFilterUrl() + this.titleFilterUrl();
    },
    gridSource: new kendo.data.DataSource({
        transport: {
            read: {
                url: function () { return viewModel.Url() }, // this is where I'm having trouble
                dataType: "jsonp",
                async: false
            }
        },
        schema: {
            data: "songs",
            total: "count",
            model: {
                fields: {
                    Artist: { type: "string" },
                    Title: { type: "string" },
                    Category: { type: "string" },
                    Gender: { type: "string" },
                    CatalogNumber: { type: "string" }
                }
            }
        },
        page: 1,
        pageSize: 50,
        serverPaging: true,
        serverFiltering: true,
        serverSorting: true
    })
});
Kevin
Top achievements
Rank 1
 answered on 28 Mar 2014
12 answers
834 views
How can I bind a select element to a kendo.data.DataSource? I know a select element can bind to an array of JavaScript objects but I would like to use the kendo.data.DataSource instead. I've been following the example in the demo here although it doesn't use a DataSource.

The error message I get in the console of the simulator is "Uncaught ReferenceError: DEP_ID is not defined"

Some example code, that shows what I'm trying to do and returns the above error, is below. Note that I am using Graphite and have included the SQLite plugin in my project.

<div data-role="view" id="tabstrip-Employees" data-title="Employees" data-model="employeeVM">
    Department
    <select data-bind="source: departmentSource"
        data-value-field="DEP_ID" data-text-field="DEP_Name">
    </select>
</div>

var employeeVM = kendo.observable({
    departmentSource: new kendo.data.DataSource({
        transport: {
            read: function(options){
                data.db.transaction(function(tx) {
                    tx.executeSql("SELECT DEP_ID, DEP_Name FROM Department", [], 
                        function (tx, rs) {
                            options.success(data.toArray(rs));
                        }, 
                        data.onError);
                });
            }
        }
    });
});

var data = {
    db: null,
    
    init: function() {
        data.openDb();
        data.createTables();
    },
    
    openDb: function() {
        if(window.sqlitePlugin !== undefined) {
            data.db = window.sqlitePlugin.openDatabase("SuperStore");
        } else {
            // For debugging in simulator fallback to native SQL Lite
            console.log("Use built in SQL Lite");
            data.db = window.openDatabase("SuperStore", "1.0", "SuperStore", 200000);
        }
    },
    
    createTables: function() {
        data.db.transaction(function(tx) {
            tx.executeSql("CREATE TABLE IF NOT EXISTS [Department]( \
                [DEP_ID] INTEGER PRIMARY KEY ASC, \
                [DEP_Name] TEXT NULL \
            )", []);
            tx.executeSql("DELETE FROM Department");
            tx.executeSql("INSERT INTO Department(DEP_ID, DEP_Name) VALUES (?,?)",
                [1, "Department 1"]);
            tx.executeSql("INSERT INTO Department(DEP_ID, DEP_Name) VALUES (?,?)",
                [2, "Department 2"]);
            tx.executeSql("INSERT INTO Department(DEP_ID, DEP_Name) VALUES (?,?)",
                [3, "Department 3"]);
        }, data.onError);
    },
    
    toArray: function(result) {
        var length = result.rows.length;
        var data = new Array(length);
        for (var i = 0; i < length; i++) {
            data[i] = result.rows.item(i);
        }
        return data;
    },
    
    onError: function(tx, e) {
        if(e !== undefined){
            console.log("Error: " + e.message);
        }
        else if(tx !== undefined){
            console.log("Error: " + tx.message);
        }
    }    
};

// Wait for PhoneGap to load
document.addEventListener("deviceready", onDeviceReady, false);

// PhoneGap is ready
function onDeviceReady() {
    data.init()
    window.app = new kendo.mobile.Application(document.body, { transition: "slide", layout: "mobile-tabstrip", initial: "#tabstrip-Employees" });
    navigator.splashscreen.hide();
}



Alexander Valchev
Telerik team
 answered on 28 Mar 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
Map
Drag and Drop
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
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?