Telerik Forums
Kendo UI for jQuery Forum
4 answers
373 views

I have a more detailed look at what I'm trying to do here (http://stackoverflow.com/questions/35158369/how-do-you-customize-kendoui-grid-column-menu-for-mobile), this is the only thing stopping me right now from using the GRID.

 After looking around for desktop mode I found how to modify the column menus.

 columnMenuInit: function (e) { console.log("menu init");var field = e.field; console.log(field);var menu = e.container.find(".k-menu").data("kendoMenu"); menu.append([{text: "Highlight", spriteCssClass: "k-i-custom", content: '<div class="colorpicker' + field + '"></div>'}]); $(".colorpicker" + field).kendoFlatColorPicker({ preview: false, value: "#000", change: select});};

 

However, this does not work for mobile when mobile:true is set for the grid (A.K.A adaptive rendering mode).  How would I customize the menu for the mobile version?

Joseph
Top achievements
Rank 2
 answered on 11 Feb 2016
1 answer
203 views

I am working a set of data that contains arrays as IDs. I need some help working around this as it appears unsupported and breaks some things.

Example item from the first set of data:

{
  "id":[1,2,3,4],
  "name":"Another VIP-VID-INPUT-1",
  "internal":true
}

This data is referenced from second set of data which uses the same array IDs to refer to the first set. Example item from the second set of data:

{
  "id":2,
  "name":"Link 02",
  "head_port_id":[1,2,3,4],
  "tail_port_id":[2,2,3,4],
  "disabled":false
}

For starters I am populating a Grid with the second set of data. I use a column.template to replace "head_port_id" and "tail_port_id" with the relevant "name" field from the first set of data. This works fine.

The problem arises when I try to use a DropDownMenu inside column.editor for the "head_port_id" and "tail_port_id" columns. Clicking the cell causes an error. 

editor: function(container, options) {
    var editor = $('<input />')
        .attr('name', options.field) // "head_port_id"
        .attr('required', 'required')
        .attr('data-bind', 'value:' + options.field); // "head_port_id"
     
    container.append(editor);
     
    editor.kendoDropDownList({
        autoBind: false,
        dataSource: data.ports.datasource, // the first set of data
        dataTextField: 'name',
        dataValueField: 'id'
    });
}
  The error I get looks like this:

Uncaught TypeError: o[s].get is not a function
E.widget.value.v.extend.refresh @ kendo.all.js:8886
I.extend.bind @ kendo.all.js:8153
w.extend.applyBinding @ kendo.all.js:9146
I.extend.bind @ kendo.all.js:9096
a @ kendo.all.js:9239
a @ kendo.all.js:9247
a @ kendo.all.js:9247
s @ kendo.all.js:9262
c.extend.refresh @ kendo.all.js:36822
c.extend.init @ kendo.all.js:36731
(anonymous function) @ kendo.all.js:2382
b.extend.each @ jquery-1.9.1.min.js:3
b.fn.b.each @ jquery-1.9.1.min.js:3
e.fn.(anonymous function) @ kendo.all.js:2381
ue.ui.DataBoundWidget.extend.editCell @ kendo.all.js:45210
(anonymous function) @ kendo.all.js:45168
b.event.dispatch @ jquery-1.9.1.min.js:3
v.handle @ jquery-1.9.1.min.js:3

Since I have the minified code it's difficult to debug this, even though I can see the full source code (a source map is loaded I assume). Breakpoints and scope vars aren't cooperating.

Anyway I had an idea which was to define a "parse" function for all of the array ID fields, in my Models. It simply converted the ID arrays .toString(). This works pretty well except that it has a fatal flaw in which the data I send to the relevant service is now invalid, since the service is expecting arrays and not strings.

How can I convert these IDs back to arrays, ideally without doing this in the DataSource transport functions (update, create, etc)? I have a generic DataSource wrapper that I am using to wrap our own CRUD interface.. I don't want it to have special cases in it for this once type of data.

T. Tsonev
Telerik team
 answered on 11 Feb 2016
3 answers
849 views

Hi All

 

I am using kendo UI 2016.1.112 with angular and I am having an issue with sorting, the first time e.data.sort is populated nicely with the field and direction , second time same field and direction as desc but clicking for third time get an empty array

     

     dataSource: {
        transport: {
            read: function (e) {
                if (!e.data.sort || e.data.sort.length === 0) {

                 ///WTH ..... WHY?

                }
                var sort = e.data.sort[0];
                exclusionsService.getExclusions(e.data.skip, e.data.take, sort.field, sort.dir).then(function (data) {
                    e.success(data);
                });
...

Dimo
Telerik team
 answered on 11 Feb 2016
1 answer
102 views

I've got xslt file which consists of many tables. 
I set id to each table. How can I set grid on id?

<table class="grid" id="ID0EEC">
      <tbody><tr>
        <th>Numb</th>
        <th>Time</th>
        <th>Type</th> 
      </tr>
      <tr>
        <th>47217283640322</th>
        <th>10.01.2014 15:25:17</th>
        <th>ATM</th> 
      </tr>
      <tr>
        <th>46961091840322</th>
        <th>12.01.2014 09:07:47</th>
        <th>Kasino</th> 
      </tr>
      <tr>
        <th>46519990240322</th>
        <th>25.01.2014 22:47:00</th>
        <th>Cash</th> 
      </tr>
    </tbody></table>

 

<table class="grid" id="ID0EJG">
      <tbody><tr>
        <th>Numb</th>
        <th>Time</th>
        <th>Type</th> 
      </tr>
      <tr>
        <th>47217283640322</th>
        <th>10.01.2014 15:25:17</th>
        <th>ATM</th> 
      </tr>
      <tr>
        <th>46961091840322</th>
        <th>12.01.2014 09:07:47</th>
        <th>Kasino</th> 
      </tr>
      <tr>
        <th>46519990240322</th>
        <th>25.01.2014 22:47:00</th>
        <th>Cash</th> 
      </tr>
    </tbody></table>


I would like to do smth like thin in JS
  var gridArray = $("#grid");
        for (var i = 0; i < gridArray.length; i++) {
            var tmp = gridArray[i];
            var numb = tmp.getAttribute('id');
            $("#" + numb).kendoGrid({});
        } 

 

 

What is wrong?

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 11 Feb 2016
1 answer
204 views

What I'm trying to do is display some data in a specific column that is calculated by using the data from another column.

I currently have a function that returns the number of available licenses for the given 'Id' in JSON:

function getAvailableLicenses(id) {
    var url = "/Host/Organization/AvailableLicenses/" + id;
    $.get(url, function (data) {
        return data.AvailableLicenses;
    });
}

 

How do I go about displaying the number that is returned in a column named "AvailableLicenses"?

Here is my current Grid:

$("#OrganizationGrid").kendoGrid({
    dataSource: viewModel.get("orgDataSource"),
    filterable: {
        extra: false
    },
    sortable: true,
    pageable: true,
    columns: [
        { field: "Id", hidden: true },
        { field: "Name", template: "<a href='/Host/Organization/Detail/#:Id#'>#:Name</a>"},
        { field: "LicenseNumber", title: "Number of Licenses" },
        { field: null, title: "Available Licenses", template: "#= getAvailableLicenses(Id) #" },
        { field: "LicenseExpiration", title: "License Expiration", format: "{0:MM/dd/yyyy}" },
        { field: "State" },
        { field: "Active" }
    ],
    editable: false
});

 

As you can see, I tried to create a null column with a template that calls the function for the given 'Id'.

By using Fiddler, I can see that the function is indeed being called for all of the rows, but the 'AvailableLicenses' column just displays "undefined" for every row.

Is there something I'm missing here to get this to work?

Austin
Top achievements
Rank 1
 answered on 11 Feb 2016
1 answer
103 views

I could have a very n-deep treeview but the way the dataTextfield operates solves my problem. Is it possible, when the node is expanded, that you modify the array for which the dataTextField is displayed?

 For example:

 When the call is made to the service, the JSON Object return is:

The first node name should be : VBN

so the dataTextField: [SSM.securitySelectionModelName]

 

{"id": 1, "isSSMNameNode": true, "tgtWeight": 0.0, "currWeight": 0.0, "hasChildNode": true, "ext_model_id": 1, "parent": null, "SSM": {"id": 1, "securitySelectionModelName": "VBN"}

 

On the next get, it should be ["SSM.securitySelectionModelName", "SSM.classificationName]"

[{"id": 2, "isSSMNameNode": false, "tgtWeight": 0.0, "currWeight": 0.0, "hasChildNode": true, "ext_model_id": 14, "parent": {"id": 1, "isSSMNameNode": true, "tgtWeight": 0.0, "currWeight": 0.0, "hasChildNode": true, "ext_model_id": 1, "parent": null, "SSM": 1, "classificationNameNode": null}, "SSM": {"id": 1, "securitySelectionModelName": "VBN", "classificationNameNode": {"id": 14, "classificationLevel": 2, "classificationName": "MBS", "hasChildNode": false, "parent": 2}}]

 Is this possible to do on the expand event where I create the dataTextField array dynamically?

Boyan Dimitrov
Telerik team
 answered on 11 Feb 2016
1 answer
155 views

Hi,

    I'm not able to add Multi column Header grid. I'm trying this

@(Html.Kendo().Grid<SkyResMVC.Models.TAChartDetails>()
                        .Name("TAChartGrid")
                        .HtmlAttributes(new { style = "height: 400;" })
                        .Scrollable()
                        .Columns(columns =>
                            {
                                columns.Bound(p => p.RoomType).Width(120).Title("A");
                                columns.Group(group => group
                                .Title("Contact Info")
                                    .Columns(info =>
                                    {
                                        info.Bound(x => x.ContactTitle).Width(200);
                                    })
                            );
                            })
                                )

 

I'm getting error like this-

Kendo.Mvc.UI.Fluent.GridColumnFactory<SkyResMVC.Models.TAChartDetails>' does not contain a definition for 'Group' and no extension method 'Group' accepting a first argument of type 'Kendo.Mvc.UI.Fluent.GridColumnFactory<SkyResMVC.Models.TAChartDetails>' could be found (are you missing a using directive or an assembly reference?)

 

Please help me in this....

 

 

Dimiter Madjarov
Telerik team
 answered on 11 Feb 2016
4 answers
219 views

I'm using the grid setOptions/getOptions to save a particular view for a grid.   Basically a user can filter the grid in a certain way, show and hide columns, etc.

 In the grid I have several inline drop downs.  This is an example of one of the field definitions:

{ field: "LocationId", title: "Location Name", width: 200, editor: gridHelper.locationDropDownEditor, template: "#=gridHelper.getLocationCode(LocationId)#" },

On initial load everything works absolutely fine.  The problem comes in when the user selects a different view and I call setOptions to instantiate that view.   For the most part everything works, however when clicking on a cell with a dropdown the dropdown does not get reinitialized as a dropdown.  It's simply a text field with the right Location Name displayed, however when you click it you get the id#.

Is there a proper way to reinitialize those dropdowns using the model I've given above?

I've tried refreshing both the grid and the datasource along with destroying and recreating the grid from scratch but no options seem to lead to something that will work.

 Thanks!

 

 

 

 

Robert
Top achievements
Rank 1
 answered on 11 Feb 2016
2 answers
378 views

Hi,

when I use declarative syntax, e.g.

<div id="app">
      <div id="list" data-role="list" data-bind="source: productsSource" data-template="tmpl"></div>
      <div id="pager" data-role="pager" data-bind="source: productsSource"></div>
 </div>

 and use MVVM binding to bind to dataSource:

var vm= kendo.observable({
           productsSource: new kendo.data.DataSource({
                    pageSize: 4, page: 1,
                    serverFiltering: true,
                    serverSorting: true,
                    transport: {
                          read: {
                              url: "http://demos.telerik.com/kendo-ui/service/Products",
                              dataType: "jsonp"
                             
                              }
                    }
                })
                      
            });
         
         
          kendo.bind($("#app"), vm);  

 

 there are two requests to http://demos.telerik.com/kendo-ui/service/Products (one for list and one for pager).

The whole example could be seen on: http://dojo.telerik.com/OHeMI/2

It is possible to reduce request count only to one?

 

Ernestas
Top achievements
Rank 1
 answered on 11 Feb 2016
8 answers
593 views
Hi,

I have a Kendo TreeView in a Kendo window. The window is intialised and hidden on document ready

var categoryWindow;
 
$(document).ready(function () {
    categoryWindow = $("#category-tree").kendoWindow({
            actions: ["Close", "Maximize"],
            draggable: false,
            height: "350px",
            modal: true,
            resizable: false,
            title: "Browse Document Categories",
            width: "500px",
            visible: false
        }).data("kendoWindow");
});
A click event then opens the window. The tree loads up and first level of nodes are loaded, but when I try to expand, it shows the spinning disk for a while, but then does not show any children.

Using fiddler I can see the child elements are being sent back by the ajax request and when I move the control outside of the window it works without any problems.

I am creating the tree using the ASP.NET MVC wrappers.

<div id="category-tree">
     
@(Html.Kendo().TreeView()
              .Name("category-treeview")
              .DataTextField("Name")
              .Events(e => e.Select("onTreeViewSelect"))
              .DataSource(ds => ds.Read(r => r.Action("TreeView", "Categories"))))
 
</div>
UPDATE: Just tested using pure JavaScript and the same problem occurs, so it's not specifically to do with the ASP.NET MVC wrappers
Dimiter Madjarov
Telerik team
 answered on 11 Feb 2016
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
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
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?