Telerik Forums
Kendo UI for jQuery Forum
1 answer
213 views
Hi, what am I missing? I'm trying to initialize a datasource with a simple array as data, just like in the documentation http://docs.kendoui.com/api/framework/datasource#methods
. But I cannot get it working.

    var orders = [ { orderId: 10248, customerName: "Paul Smith" }, { orderId: 10249, customerName: "Jane Jones" }];
var dataSource = new kendo.data.DataSource({
     data: orders
});
     
   var order = dataSource.at(0);
     
   if (typeof(order)=="undefined") {
       alert("fail");
   } else {
       alert(order.customerName);
   };


http://jsfiddle.net/HB8NZ/

thanks
Jonas
Top achievements
Rank 1
 answered on 13 Oct 2012
0 answers
119 views
Hi Team,

I have a created a tree using JsonObject dynamically.

$("#treeview").kendoTreeView({
                template:kendo.template($("#treeview-template").html()),

                checkboxTemplate:kendo.template($("#treeview-checkbox-template").html()),
                hasChildren:true,
                dataSource: <?=$jsonDataForTree?>,
                EnableCaching:false
            });

now that i have a tree , I would like to have a copy paste functionality for this same.
1. I have disabled the move option as this not required as per our requirements.
2. I have created two buttons "Copy" and "Paste"
                   Usage : select a node and go to other node and simply click Paste button. This would copy the entire source(including the nested nodes) to destination.

How can this be achieved ? your help is highly appreciated.

Thanks in advance,
Prasad.
prasad
Top achievements
Rank 1
 asked on 13 Oct 2012
1 answer
368 views
Hi, I'm implementing the library Kendo UI Web (not MVC server wrapper) in an ASP.NET MVC4 web application (razor), with encouraging results regarding the use of kendogrid and kendowindow. But the problems start when I try to use multiple nested modal windows.

The scenario is as follows:
- a "_Layout.vbhtml" template with references to (in order) jquery-1.7.1.js, jquery.validate.js, jquery.validate.unobtrusive.js and kendo.web.min.js.
- an "Index.vbhtml" view with a kendogrid that correctly loads JSON data from a call to a controller action.
In this view I put also a modal kendowindow that dynamically loads in its content the CRUD forms when the user clicks on a grid row.

Regarding the Create and Update operations, the forms (loaded into this first modal window) consist respectively of two views, "Create.vbhtml" and "Edit.vbhtml", that share the same partial view "_CreateOrEdit.vbhtml" from which I have to open another modal kendowindow for lookup operations during the filling of the form.

All data and operations of all components (loading data, form validation, opening and closing kendowindows, the availability of the KendoUI environment) work alternately, depending on the manner in which I insert or less of additional references to scripts "jquery-1.7.1", "jquery.validate", "jquery.validate.unobtrusive" and "kendo.web.min" on top of the views or partial views, in addition to those references present in "_Layout.vbhtml".

At the moment I can: load the main grid, click on a row and open the first modal dialog with the edit form, regularly open the second modal lookup kendowindow with a grid inside correctly running, but when I try to close the second kendowindow I get the js error "L(b) is undefined" or an error like "$("#kLookup").data("kendoWindow") is undefined" (but "$("#kLookup")" is defined!)!!!

I want to know if the library KendoUI Web is compatible with such a scenario (a bit complicated to explain, but actually quite simple). Are there guidelines or best practice about how I have to reference to the JavaScript scripts to get a correct use of the library without conflict with JQuery, JQueryValidate and the usage of nested modal kendowindow?

Thanks in advance!
Andrea
Andrea
Top achievements
Rank 1
 answered on 13 Oct 2012
0 answers
79 views
Is that possible to make first column title/heading as what ever we selected from drop down. For example :- If a serial number is searched , serial number should be in the first column of the search. But I am unable to get that since we defined column definition generically in sorted manner. Depending upon selection we hide rest of the column. for example:

xxx.xxxColDef = [ {
    field : "serialNo",
    title : "Serial No",

}, {
    field : "firstname",
    title : "firstname",
    }, {
    field : "lastnameo",
    title : "lastname",
    },


from the drop down if i select first name the first name should be in the first column. but i am getting first column as serial no Is there any way? without adding separate column definition for each.this should be done automatically not using column re-ordering not manually
Vinodh
Top achievements
Rank 1
 asked on 13 Oct 2012
1 answer
460 views
Hi,

Does anyone know if there is an obvious configuration entry that would do this, before I start delving into it more.

Currently my URL to the ODATA service is using the following

/_vti_bin/listdata.svc/Inventory?take=5&skip=0

It needs to have the dollar signs before each of the parameters for it to work.

Any ideas?

Cheers

My custom odata file

/*
* Kendo UI Web v2012.1.322 (http://kendoui.com)
* Copyright 2012 Telerik AD. All rights reserved.
*
* Kendo UI Web commercial licenses may be obtained at http://kendoui.com/web-license
* If you do not own a commercial license, this file shall be governed by the
* GNU General Public License (GPL) version 3.
* For GPL requirements, please review: http://www.gnu.org/copyleft/gpl.html
*/
(function($, undefined) {
    var kendo = window.kendo,
        extend = $.extend,
        odataFilters = {
            eq: "eq",
            neq: "ne",
            gt: "gt",
            gte: "ge",
            lt: "lt",
            lte: "le",
            contains : "substringof",
            endswith: "endswith",
            startswith: "startswith"
        },
        mappers = {
            pageSize: $.noop,
            page: $.noop,
            filter: function(params, filter) {
                if (filter) {
                    params.$filter = toOdataFilter(filter);
                }
            },
            sort: function(params, orderby) {
                params.$orderby = $.map(orderby, function(value) {
                    var order = value.field.replace(/\./g, "/");


                    if (value.dir === "desc") {
                        order += " desc";
                    }


                    return order;
                }).join(",");
            },
            skip: function(params, skip) {
                if (skip) {
                    params.$skip = skip;
                }
            },
            take: function(params, take) {
                if (take) {
                    params.$top = take;
                }
            }
        },
        defaultDataType = {
            read: {
                dataType: "jsonp"
            }
        };


    function toOdataFilter(filter) {
        var result = [],
            logic = filter.logic || "and",
            idx,
            length,
            field,
            type,
            format,
            operator,
            value,
            filters = filter.filters;


        for (idx = 0, length = filters.length; idx < length; idx++) {
            filter = filters[idx];
            field = filter.field;
            value = filter.value;
            operator = filter.operator;


            if (filter.filters) {
                filter = toOdataFilter(filter);
            } else {
                field = field.replace(/\./g, "/"),


                filter = odataFilters[operator];


                if (filter && value !== undefined) {
                    type = $.type(value);
                    if (type === "string") {
                        format = "'{1}'";
                        value = value.replace(/'/g, "''");
                    } else if (type === "date") {
                        format = "datetime'{1:yyyy-MM-ddTHH:mm:ss}'";
                    } else {
                        format = "{1}";
                    }


                    if (filter.length > 3) {
                        if (filter !== "substringof") {
                            format = "{0}({2}," + format + ")";
                        } else {
                            format = "{0}(" + format + ",{2})";
                        }
                    } else {
                        format = "{2} {0} " + format;
                    }


                    filter = kendo.format(format, filter, value, field);
                }
            }


            result.push(filter);
        }


        filter = result.join(" " + logic + " ");


        if (result.length > 1) {
            filter = "(" + filter + ")";
        }


        return filter;
    }


    extend(true, kendo.data, {
        schemas: {
            odata: {
              type: "json",
              data: "d.results",
              total: "d.__count"
          }        
        },
        transports: {
          odata: {
              read: {
                  cache: true, // to prevent jQuery from adding cache buster
                  dataType: "jsonp",
               //   jsonp: "$callback"
              },
              parameterMap: function(options, type) {
                  type = type || "read";
 
                  var params = {
                          $inlinecount: "allpages"
                      },
                      option,
                      dataType = (this.options || defaultDataType)[type].dataType;
 
                  options = options || {};
 
                  for (option in options) {
                      if (mappers[option]) {
                          mappers[option](params, options[option]);
                      } else {
                          params[option] = options[option];
                      }
                  }
                  return params;
              }
          }
      }        
      }
    });
})(jQuery);

My datasource parameters

var dataSource = new kendo.data.DataSource({
type: "odata.sharepoint",
transport: {
read:
{
url: "_vti_bin/listdata.svc/Inventory",
contentType: "application/json; charset=utf-8" ,
type: "GET",
dataType: "json"
}
},
schema: {
data: "d.results",
total: "d.__count",
model: {
fields: {
Make: { type: "string" },
Model: { type: "string" },
Price: { type: "number" },
PictureUrl: { type: "string" }
}
}
},
pageSize: 5,
serverPaging: true,
serverFiltering: true,
serverSorting: true
});



Jeff
Top achievements
Rank 1
 answered on 12 Oct 2012
1 answer
227 views
I am trying to highlight a range of acceptable values on the value axis of a line chart.  I initially thought of adding a series with the data property set to a single value, but this produces a bar on the chart rather than a line at y = k.  Ultimately I am displaying blood glucose readings and need to show the values' relationship to the normal high and low.

Any ideas are appreciated.
Iliana Dyankova
Telerik team
 answered on 12 Oct 2012
1 answer
152 views
I've attached a PNG that shows my issue. I have inspected it with Chrome's debugging tools and cannot seem to find the issue.

This control is within a SharePoint 2010 customized EditForm. I would be thankful for any help anyone can give.

If for any reason you cannot see th image the pager basically looks like this.

<<
1 2  >>

And not

<<  1 2  >>
Dimo
Telerik team
 answered on 12 Oct 2012
2 answers
295 views
Hi,

I have requirements that date should be presented in the browser based on the user system settings in "Region and Language -> Formats -> Short Date", so in US it should be "M/d/yyyy" and in Bulgaria it should be "d.M.yyyy".  I know that Kendo UI supports localization, but I could not figure out how to do that.

This date should be presented in grid and I am using ASP.NET MVC 4.0 with Kendo UI MVC grid control.

Thanks for help.

Thanks.
Vlad
Top achievements
Rank 1
 answered on 12 Oct 2012
2 answers
158 views
I was trying to recreate the custom command demo and I'm having an issue.

The issue seems to relate to the text property on the command:
command: { text: "View Details", click: showDetails }, title: " ", width: "140px"


Using the kendo.web.min.js file the following html is generated for the button.
<a class="k-button k-button-icontext k-grid-View Details" href="#">
   <span class=" "></span>
   View Details
</a>

Your demo using kendo.all.min.js:
<a class="k-button k-button-icontext k-grid-ViewDetails" href="#">
     <span class=" "></span>
     View Details
</a>

The class should be "k-grid-VIewDetails" like the "kendo.all.min.js" but in the "kendo.web.min.js" it is creating two classes one being "k-grid-View" and "Details"

This causes the button to not work.  Taking the space out of "View Details" when defining the text property for the command allows the button to work with no other modifications.
Jesse
Top achievements
Rank 1
 answered on 12 Oct 2012
2 answers
1.0K+ views
Hi,

My requirement is to show a single line of text per row in the grid. The default behavior of the grid is to show long text on multiple lines. Is there a way to show just one line of text?

Regards,
Sarvesh
Sarvesh
Top achievements
Rank 1
 answered on 12 Oct 2012
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
Bronze
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
Bronze
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?