Telerik Forums
Kendo UI for jQuery Forum
2 answers
179 views
Hi,
I'm  a newbie and trying to get a pair of cascading comboboxes to work from a grid custom editor popup.
The first combobox appears to work fine, but the second one does not appear to be getting the value of the selected item from the first combobox. Accordingly, the 2nd datasource is being called without a paramater

Here is my code. Thanks for assistance.


 
          $(document).ready(function() {
               var element = $("#qcgrid").kendoGrid({
                    dataSource: {
                          type: "json",transport: {
   
                                read: {url: "/backoffice/archiveitemlist"},
update: {url:  "/backoffice/qcupdate"},
destroy: {url: "/backoffice/qcdestroy"},

parameterMap: function(options, operation) {
                                    if (operation !== "read" && options.models) {
                                        return {models: kendo.stringify(options.models)};
                                    }
}

                            },
                            pageSize: 6,
   batch: true,
                            schema: {
                                model: {
                                    id: "FileName",
                                    fields: {
                                        Description: {},
                                        catdescription: {},
                                        catsubdescription: {},
                                        StartDate: {},
                                        EndDate: {},
StartYear:{},
EndYear:{},
                                    }
                                }
                            }
                        },
                        height: 450,
                        //sortable: true,
                        //pageable: true,
                        detailTemplate: kendo.template($("#mytemplate").html()),
                        detailInit: detailInit,
                        dataBound: function() {
                            this.expandRow(this.tbody.find("tr.k-master-row").first());
                        },
                        columns: [
//    {
// field: "ArchiveItemId",
// title: "ArchiveItemId"                            
//    },
   {
field: "FileName",
   },
   
   {
field: "Description",  
   },
   {
field: 'catdescription',
title: "Category",
       editor: function(container, options) {
   // create first box of a KendoUI cascading combobox widget as column editor
    $('<input name="' + options.field + '"/>').appendTo(container).kendoComboBox({
placeholder: "Select category...",
dataTextField: "Category",
dataValueField: "CategoryId",
dataSource: {
   type: "JSON",
   serverFiltering: true,
   transport: {
   read: "/backoffice/categories.json"
   }
}
});
   
   }
   },
                                    {
field: 'catsubdescription',
title: "SubCategory",
editor: function(container, options) {
   // create second cascading combobox widget
    $('<input name="' + options.field + '"/>').appendTo(container).kendoComboBox({
autoBind: false,
cascadeFrom: "catdescription",
placeholder: "Select subcategory...",
dataTextField: "SubCategory",
dataValueField: "SubCategoryId",
dataSource: {
   type: "JSON",
   serverFiltering: true,
   transport: {
   read: "/backoffice/subcategories.json?filter[filters][0][value]="      //No value is being appended here
   }
}

}).data("kendoComboBox");
}
   },
Peter
Top achievements
Rank 1
 answered on 18 Jan 2013
1 answer
331 views
I recently had cause to configure a kendo mobile listview with a headerTemplate for grouped data. The reason was that I wanted to group by one field but use another for the displayed label since the former had the correct sort order. The template looked like this:
<script type="text/x-kendo-templ" id="header-template">
${data.items[0].section}
</script>

Where 'section' was a defined field in my data source.

When I try the same approach with a kendo web grid then an error 'undefined' is thrown. I've googled and checked the docs and apart from references to 'value', 'max', 'sum' I can't seem to find anything that clarifies what is available to the template at this point. Ideally I want to make the same type of reference as works for the mobile listview.

Thanks,

Mark.

Alexander Valchev
Telerik team
 answered on 18 Jan 2013
5 answers
94 views
Hello,
We're currently evaluating Kendo UI and we've jumped on a strange issue. When using fields with dropdown widgets, the grid sends a not serialized JavasSript object, which basically the string "[object Object]". I've tried to serialize this data by myself, using `parameterMap(options)`, but even there the values were already two "[object Object]" string. Checkout the screenshot I've attached.
 
I've created a static example in order to present you the issue more easily. This my data store:
kendo.django_stores = {};
kendo.django_stores.RoomTypeDataStore = new kendo.data.DataSource({
  "sort": [],
  "serverPaging": false,
  "serverFiltering": false,
  "serverSorting": false,
  "pageSize": null,
  "transport": {
    "read": {
  "dataType": "json",
  "type": "GET"
    },
  "destroy": {
  "dataType": "json",
  "type": "POST"
  },
  "create": {
  "dataType": "json",
  "type": "POST"
  },
  "update": {
    "dataType": "json",
    "type": "POST"
  }
  },
  "schema": {
    "type": "json",
    "model": {
      "fields": {
        "capacity": {
          "nullable": false,
          "defaultValue": 0,
          "editable": true,
          "values": [],
          "validation": {
            "required": true
          },
          "type": "number"
        },
        "name": {
          "nullable": false,
          "defaultValue": null,
          "editable": true,
          "values": [
          {
            "text": "Single room",
            "value": "single"
          },
          {
            "text": "Double room",
            "value": "double"
          }
          ],
            "validation": {
              "required": true
            },
            "type": "string"
        },
        "hotel": {
          "nullable": false,
          "defaultValue": null,
          "editable": true,
          "values": [],
          "validation": {
            "required": true
          },
          "type": "string"
        },
        "pk": {
          "editable": false,
          "nullable": true
        },
        "breakfast": {
          "nullable": false,
          "defaultValue": null,
          "editable": true,
          "values": [
          {
            "text": "With breakfast",
            "value": "breakfast"
          },
          {
            "text": "With continential breakfast",
            "value": "continential"
          },
          {
            "text": "With buffet breakfast",
            "value": "buffet"
          },
          {
            "text": "With English breakfast",
            "value": "English"
          },
          {
            "text": "Without breakfast",
            "value": "without"
          }
          ],
            "validation": {
              "required": true
            },
            "type": "string"
        },
        "id": {
          "nullable": false,
          "defaultValue": null,
          "editable": true,
          "values": [],
          "validation": {
            "required": false
          },
          "type": "string"
        }
      },
      "id": "pk"
    },
    "total": "total",
    "data": "results"
  }
});
I initialize the grid in an empty div
<div id="rooms_grid"></div>
$(document).ready(function() {
  var RoomTypeDataStore = kendo.django_stores.RoomTypeDataStore;
  var fields = RoomTypeDataStore.options.schema.model.fields;
 
  $('#rooms_grid').kendoGrid({
    dataSource: RoomTypeDataStore,
    height: 800,
    sortable: true,
    scrollable: true,
    editable: 'popup',
    destroyable: true,
    toolbar: ["create"],
    columns: [
      {field: "name", title: "Name", values: fields.name.values},
      {field: "capacity", title: "Capacity", format: "{0:n0}"},
      {field: "breakfast", title: "Breakfast", values: fields.breakfast.values},
      {command: ["edit", "destroy"]}
    ]
  });
});
I use jQuery 1.8.3, the latest version of KendoUI Web and this is how the external resources are loaded.:
<link href="./static/styles/kendo.common.min.css" rel="stylesheet" type="text/css">
<link href="./static/styles/kendo.default.min.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="./static/js/jquery.js" charset="utf-8"></script>
<script type="text/javascript" src="./static/js/kendo.web.min.js" charset="utf-8"></script>
Cheers,
Kiril Vladimirov
Brett
Top achievements
Rank 2
 answered on 18 Jan 2013
1 answer
155 views
Hi, I have tried my best but could not resolve one issue. I am using kendo grid in mobile application. Because project requirements are to use grid as starting point (let say list of people with their demographic info) then click on grid row or button to navigate to the details. I am using button and in its click event I want to navigate to kendo mobile view.

   function buttonClick(e) {
                    $('a').prop('href', '#tabstripprofile');
                                        
                    }
tabstripprofile is the id for the view. That code does work in Chrome or Firefox and also works with Windows emulator. But it does not work for android emulator or android device. I have tested an alert by adding in the code and the click event is being called and each time the popup generates twice, but the navigation part does not work. However if I keep pressing the button then it navigates at random times but not every time. Please help. 
Alexander Valchev
Telerik team
 answered on 18 Jan 2013
1 answer
175 views
I am trying to bind the view() function on the DataSource to a select element then apply a filter to restrict the results however it is not working.

My expected result in the demo is that by changing the Package to "Application" the Module values would change.
http://jsfiddle.net/v6PBz/3/

Thanks, Justin
Alexander Valchev
Telerik team
 answered on 18 Jan 2013
2 answers
371 views
I'm new to Kendo UI and struggling to get menus declared using "straight" HTML to work.  However I can get the menus to work if I use code like the following in an MVC view:

   @(Html.Kendo().Menu()
          .Name("Menu")
          .Items(items =>
          {
              items.Add()
                .Text("Menu Option 1")
                .Items(children =>
                    {
                        children.Add().Text("Submenu 1-1")
                                .Items(innerChildren =>
                                    {
                                        innerChildren.Add().Text("Submenu 1-1 Option 1");
                                        innerChildren.Add().Text("Submenu 1-1 Option 2");
                                        innerChildren.Add().Text("Submenu 1-1 Option 3");
                                    });

                        children.Add().Text("Submenu 1-2")
                                .Items(innerChildren =>
                                    {
                                        innerChildren.Add().Text("Submenu 1-2 Option 1");
                                        innerChildren.Add().Text("Submenu 1-2 Option 2");
                                    });
                        children.Add().Text("Submenu 1-3")
                                .Items(innerChildren =>
                                    {
                                        innerChildren.Add().Text("Submenu 1-3 Option 1");
                                        innerChildren.Add().Text("Submenu 1-3 Option 2");
                                    });
                    });
              items.Add()
                .Text("Menu Option 2")
                .Items(children =>
                {
                    children.Add().Text("Submenu 2-1")
                            .Items(innerChildren =>


I'd like to individually style each top level button ("Menu Option 1" and "Menu Option 2") to have a different colour, but cannot see a way to add a CSS style tag to the individual Item (I was hoping for a property similar to "Text" called "Id" or "CssClassId").

In the code example above how could I style "Menu Option 1" to be green, and "Menu Option 2" to be red?
Ian
Top achievements
Rank 1
 answered on 18 Jan 2013
3 answers
228 views
There are two things I would like to accomplish:

1. I want to be able to use a Kendo Numeric Textbox in my Kendo Grid without binding it to a field.
2. I want to be able to retrieve this value.

My grid looks as follows:

@(Html.Kendo().Grid<ProofData>()
        .Name("ProofDataGrid")
        .AutoBind(true)
        .HtmlAttributes(new { style = "height: 500px; font-size: 12px;" })
        .Columns(columns =>
        {
            columns.Bound(c => c.Number).Groupable(false);
            columns.Bound(c => c.ProofAmount).Groupable(false);
            columns.Bound(c => c.ProofAssignmentID).Groupable(false);
            columns.Bound(c => c.PrimaryAmount).Groupable(true);
            columns.Bound(c => c.PrimaryAssignmentID).Groupable(true);
            columns.Template(@<textarea></textarea>).Title("FinalData");
        }
        )
            .ToolBar(toolbar =>
            {
                toolbar.Save();
            })
                .Editable(editable => editable.Mode(GridEditMode.InCell))
        .Pageable(pageable => pageable
            .Enabled(true)
            .PageSizes(new int[4] { 5, 10, 25, 50 })
            .Refresh(true))
            .Navigatable(n => n.Enabled(true))
        .Sortable()
        .Scrollable()
        .Selectable()
        .DataSource(datasource => datasource
                .Ajax()
                .Batch(true)
                .Update("Editing_Update", "Grid")
                .Model(model => model.Id(c => c.ID))
                .ServerOperation(false))
                        .Events(ev => ev.SaveChanges("debugData"))
    )

When I click a button, I format the Grid as follows:

function formatProofGridData(id) {

        var dataSource = new kendo.data.DataSource({
            transport: {
                read: {
                    url: "/Proofing/GetInconsistentData/",
                    dataType: "json",
                    data: { id: id }
                }
            },
            // determines if changes will be send to the server individually or as batch
            batch: true,
                model: {
                    id: "ID",
                    fields: {
                        ID: { validation: { required: true} },
                        Number: { editable: false },
                        ProofAmount: { editable: false },
                        PrimaryAmount: { editable: false },
                        ProofAssignmentID: { editable: false },
                        PrimaryAssignmentID: { editable: false },
                    }
                }
            }
            //...
        });
        $("#ProofDataGrid").kendoGrid({
            dataSource: dataSource,
            toolbar: ["save", "cancel"],
            editable: { update: true },
            scrollable: true,
            sortable: true,
            pageable: true,
            columns: [
                    {
                        field: "Number",
                        title: "Number"
                    },
                      {
                          field: "ProofAmount",
                          title: "ProofAmount"
                      },
                      {
                          field: "PrimaryBidAmount",
                          title: "PrimaryBidAmount"
                      },
                      {
                          field: "ProofAssignmentID",
                          title: "ProofAssignmentID"
                      },
                      {
                          field: "PrimaryAssignmentID",
                          title: "PrimaryAssignmentID"
                      },
                      {
                          title: "FinalData",
                          template: '<input id="numeric" type="number" value="" min="0" max="100" step="1" />'
                      }]

        });
              }

Basically, I'm loading two sets of data side by side to compare the values to determine which has the correct values. The extra non field bound column is for me to input a value. When I click "Save", I am going to use this value to place the corrected value in another table.

I am currently loading the data this way so I can format the data before it hits the grid. So far I have been unsuccessful in converting the textbox into a numeric textbox. And secondly, I also have been unable to figure out how to retrieve the data in the textbox.

I have checked the data in $('#ProofDataGrid').data('kendoGrid').dataSource.data(); but have not seen the data I input into the textbox fields.

Any help for either issue would be appreciated.
Vladimir Iliev
Telerik team
 answered on 18 Jan 2013
1 answer
99 views
Cascading works great when a person does the item selection.  The key is that the _focus method of the List widget ( I guess an ancestor of ComboBox and DropDownList ) has this kernel:

that._select(li);
that._triggerCascade();

For the case of a programmatic selection via invocation of

.select(index)
.value(data-value)
.search(data-text)

In DropDownList

.select() will perform a ._select followed by a _triggerCascade
.value() will perform a .select(index) which will eventually do a _triggerCascade
.search() will perform a ._select only and not have a _triggerCascade

In v2012.3.1304 dropdownlist.js at line 272 there should probably needs to be a
if (that._selectedIndex > -1) { that._triggerCascade() }


Now suppose that you have three remote datasourced drop down lists to be populated and initialized based on text.
The search method could then be used in the databound callback to ensure DDL has its data before making the selection of the desired item.
$.when ( $.get ('/cgi/initialValues') )
.done ( loadDDL )
;
 
// initialValues is expected to output json of construct {DDL1:text1, DDL2:text2, DDL3:text3}
 
function LoadDDL (initial) {
  $('#DDL1').kendoDropDownList ({
    dataSource: ...
    databound: function (e) {if (initial.DDL1) {var text=initial.DDL1;initial.DDL1=null;e.sender.search(text);}}
  });
  $('#DDL2').kendoDropDownList ({
    dataSource: ...
    cascadeFrom: 'DDL1'
    databound: function (e) {if (initial.DDL2) {var text=initial.DDL2;initial.DDL2=null;e.sender.search(text);}}
  });
  $('#DDL3').kendoDropDownList ({
    dataSource: ...
    cascadeFrom: 'DDL2'
    databound: function (e) {if (initial.DDL3) {var text=initial.DDL3;initial.DDL3=null;e.sender.search(text);}}
    change: doSomethingElse
  });
   
  var doSomethingElse = function() {
  // I can operate knowing the DDLs were populated and cascaded in a 1,2,3 manner
  }
}

p.s. Autogenerated cascading DDLs could be an alternate viewer for Hierarchical Data Source

Georgi Krustev
Telerik team
 answered on 18 Jan 2013
6 answers
356 views
Will there be a Fullscreen-Support so that the address-bar of mobile browsers will disapear?
Kamen Bundev
Telerik team
 answered on 18 Jan 2013
1 answer
877 views
Consider this fiddle that uses chained deferreds to 
1. obtain an initial text that should be selected (ajax)
2. populates a drop down list (kendoDropDownList)
3. select initial text in the DDL

My problem is in step 3.
Is there a method or technique for selecting an item in the DDL based on its dataTextField ?

I saw earlier posts that indicate .value() should be used, but I only have the data text (from step 1).

The fiddle now works as I expect it to.  The .search() method was used to select an item by data text.

Thanks,
Richard
Georgi Krustev
Telerik team
 answered on 18 Jan 2013
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
Date/Time Pickers
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
Drawer (Mobile)
Drawing API
Globalization
Gauges
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
ScrollView
PivotGridV2
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Collapsible
Localization
MultiViewCalendar
Touch
Breadcrumb
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
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?