Telerik Forums
Kendo UI for jQuery Forum
2 answers
125 views
I'm having a problem getting my grid to bind to some json data. I've searched the forums for a solution but no luck.

The following code throws an error of 'Unable to get value of property 'length': object is null...':


$("#search-grid").kendoGrid({
    dataSource: {
        transport: {
            read: {
                url: "a URL"
            }
        },
        schema: {
            data: "data"
        }
    },
    columns: [{field:"Name",title:"Name"}]
});
Based on some other forum posts, this is indicative of a bad json response so i copied and pasted the json from the response to a javascript variable and it works so I'm not sure what I'm doing wrong.

This works:
var testdata = { "data": [{ "Name": "TestY" }] };
 
var searchViewModel = kendo.observable({
    init: function () {
        $("#search-grid").kendoGrid({
            dataSource: {
                data: testdata,
                /*
                transport: {
                    read: {
                        url: "a URL"
                    }
                },
                */
                schema: {
                    data: "data"
                }
                 
            },
            columns: [{field:"Name",title:"Name"}]
        });
    }



I've validated my response by other means and it is valid json so I'm not sure what to try next.  Something is "wrong" with it but I don't know what.

here is the raw response:

HTTP/1.1 200 OK
Content-Length: 27
Content-Type: application/JSON
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Fri, 07 Jun 2013 20:00:59 GMT
 
{"data":[{"Name":"TestY"}]}


Thanks in advance


Any ideas?
Cody
Top achievements
Rank 1
 answered on 07 Jun 2013
2 answers
211 views
I know that I can set options on a custom widget if I instantiate the widget in code, so that the following should output "foo" to the console.
var MyWidget = kendo.ui.Widget.extend({
    init: function(element, options) {
        kendo.ui.Widget.fn.init.call(this, element, options);
 
        console.log(options.myOption);
    },
    options: {
        name: "MyWidget"
    }
});
kendo.ui.plugin(MyWidget);
 
$("#widgetRoot").kendoMyWidget({ myOption: "foo" });
Is there any way that I can do the same thing using declarative binding? I get as far as
<span id="widgetRoot" data-role="mywidget" data-bind="X"></span>
but there doesn't seem to be anything I can put in for X that gives me access to the options parameter.  I haven't been able to find anything in the blog  posts or documentation to shed light on this.
Jake
Top achievements
Rank 1
 answered on 07 Jun 2013
4 answers
660 views
I want to create a Grid with a Toggle button in the first column.

Each Row describes a layer for a map:

 1) name,  2) size, 3) type, etc.

In column 0, I would like to put a two-state toggle button.

[KEEP/DELETE] (if  this layer already exists)

or a different button if the layer does not exist

[ADD/SKIP] 

I have seen the checkbox in the GRID: http://www.kendoui.com/forums/ui/grid/grid-checkbox.aspx , but I think that to add four columns to the row (and to change it to a radio) would be confusing.

Or is there some other UX idea that I am just blanking out on.

Once the user has determined which rows to keep, delete, or to download, I will go through the .data() and do the appropriate actions.


Dr.YSG
Top achievements
Rank 2
 answered on 07 Jun 2013
3 answers
238 views

Validation used for a field in KendoGrid works fine on currently being edited cell when I try to select other cell.But It doesn't work when I try to sort any column or use filter. Is it possible to prohibit user from sorting or filtering till validation for the field passes.

Code used for validation in datasource for one of field.
01.Project:{
02.editable:true,
03.validation: {
04.custom: function(input) {
05.if(input.val()=="") {
06.input.attr("data-custom-msg", "Message");
07.return false;
08.}
09.else
10.return true;
11.}
12.}
13.}
Daniel
Telerik team
 answered on 07 Jun 2013
1 answer
6.6K+ views
Hi

I want to store selected item state. I can't trigger 'select' event properly.
    $('#groups').kendoDropDownList({
        dataSource: [
            { text: "No group", value: "none" },
            { text: "By type", value: "type_label" },
            { text: "By route", value: "route_label" },
            { text: "By status", value: "status_label" }
        ],
        dataTextField: "text",
        dataValueField: "value",
        select: function(e){
            var selectedDataItem = this.dataItem(e.item.index());
        set_global_setting ("group_state", dataItem.value);
// ... code which depends on selectedDataItem and works this.dataSource
        }
    }).data("kendoDropDownList").select(function(dataItem){
        return dataItem.value === get_global_setting("group_state");
    });
 
    var groups_dropdown = $('#groups').data("kendoDropDownList");
    groups_dropdown.trigger("select", {item : groups_dropdown.dataItem()}); // does not work since 'select' event expects 'e.item' as 'li'
When user changes selected value 'e.item' in 'select' event is a 'li'.
When I change selected value programmaticlly I should specify next selected item not as dataItem but as 'li'.
How can I do this?
Maybe I should somehow change 'selectedDataItem' definition in 'select' event?
Dimiter Madjarov
Telerik team
 answered on 07 Jun 2013
1 answer
123 views
Hi,

I have an viewmodel with an observable array of objects, and a computed selectedObject.  I'm attempting to bind a KendoListView to an observable array in selectedObject, but the ListView doesn't get updated.

There's a fiddle demonstrating the issue here:

http://jsfiddle.net/JrJ2q/3/

I'd appreciate any support you could provide.

Thanks,
John
Atanas Korchev
Telerik team
 answered on 07 Jun 2013
2 answers
96 views
Hello,

I am having a problem sorting by the column that I enabled a custom editor for. 

I basically followed the sample at http://demos.kendoui.com/web/grid/editing-custom.html 

How would you go about sorting by the "Category" column? The column it self is an object, so I think is getting confused.

Any ideas?

Thanks!
Covo
Ricardo
Top achievements
Rank 1
 answered on 07 Jun 2013
3 answers
174 views
This is for Kendo UI version 2013.1.514.340.

Here is my MVC view:

<script src="~/Scripts/jquery-1.7.1.js"></script>
<script src="~/Scripts/kendo.web.min.js"></script>
<script src="~/Scripts/kendo.aspnetmvc.min.js"></script>
<link href="~/Styles/examples.css" rel="stylesheet" />
<link href="~/Styles/kendo.common.min.css" rel="stylesheet" />
<link href="~/Styles/kendo.default.min.css" rel="stylesheet" />

@using Kendo.Mvc.UI
@model List<CV.Prototype.ViewModels.MyRecord>

@(Html.Kendo().MultiSelect()
      .Name("categoryMultiselect")
      .DataTextField("Name")
      .DataValueField("Id")
      //SERVER BINDING
          .BindTo(Model)
          .Value(Model)   
      )

My controller is simply:
        public ActionResult Index()
        {

            var x = new List<MyRecord>
                {
                    new MyRecord {Id = 1, Name = "Name1"},
                    new MyRecord {Id = 2, Name = "Name2"},
                    new MyRecord {Id = 3, Name = "Name3"},
                    new MyRecord {Id = 4, Name = "Name4"}
                };
            return View(x);
        }

All the records display inside the grey boxes, but are not inside the input text box. Also the throbber is constantly displaying. Apart from this it functions correctly both with Server and Ajax binding. Any clues as to what I might be missing?
Daniel
Telerik team
 answered on 07 Jun 2013
1 answer
270 views
Hi,

I'm not sure if this is a bug or just a misunderstanding on my part. I'm also putting this post here, but it may be more relevant for the SPA section!

When using a dropdownlist inside a view (rendered as part of an SPA layout), the following element is created at the foot of the body (as well as the normal markup):
<div style="display: none; position: absolute;" data-role="popup" id="dropdownlist1-list" class="k-list-container k-popup k-group k-reset"><ul aria-live="off" id="dropdownlist1_listbox" aria-hidden="true" role="listbox" tabindex="-1" style="overflow: auto;" unselectable="on" class="k-list k-reset">
On a view change, using layout.showIn(), I was to understand the the view and all its child elements would be removed from the DOM. As it is, these elements remain - if the view reference is retained it would appear that only one instance is created if the the view reference is recreated, a duplicate is formed when the view is rendered.

The JSFiddle here demonstrates the issue hopefully. Obviously if there are a lot of views being used with many dropdownlists, then the capacity for many of these remnants to be created could be significant. I haven't done exhaustive testing, but this doesn't seem to happen for (for example) the grid.

Grateful for any assistance!

Many thanks,

J.
Georgi Krustev
Telerik team
 answered on 07 Jun 2013
1 answer
93 views
Not sure what version of kendo  I have, but the javascript parser add-in for Visual Studio detected an anomaly in the kendo.all.min.js file -- in one place the word groupable is quoted with a single quote on the left end and a double quote on the right end.
Vladimir Iliev
Telerik team
 answered on 07 Jun 2013
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)
SPA
Filter
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
OrgChart
TextBox
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
Popover
DockManager
FloatingActionButton
TaskBoard
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
TimePicker
DateTimePicker
RadialGauge
ArcGauge
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?