Telerik Forums
Kendo UI for jQuery Forum
2 answers
740 views
I feel like I'm taking crazy pills.  I've seen this odata workaround in many places, but I can't for the life of me get it to work.  I have a simple data source that loads from an odata Web Api v2 endpoint.  The endpoint seems to be returning the JSON data appropriately, here's what I'm seeing as a response with only 2 items being returned:

{
  "odata.metadata":"http://localhost:40946/odata/$metadata#AlbumThumbnail","odata.count":"2","value":[
    {
      "ImageId":29,"Title":null
    },
    {
      "ImageId":30,"Title":null
    }
  ]
}

And here's how my data source is defined:
var thumbnailSource = new kendo.data.DataSource({
    type: "odata",
    transport: {
        read: {
            url: "/odata/AlbumThumbnail/",
            dataType: "json",
            data: {
                    id: 31
            }
        },
        schema: {
            data: function (data) {
                return data.value;
            },
            total: function (data) {
                return data["odata.count"];
            },
            model: {
                fields: {
                    ImageId: { type: "number" }
                }
            }
        }
    }
});
 
$(window).load(function () {
    thumbnailSource.read();
});

And any time it fetches data I get the usual odata error:
Unable to get property '__count' of undefined or null reference

I've tried setting breakpoints on my data() and total() functions and they're never reached.  I can't figure out why the usual internal total function is being called instead of mine.  The error occurs in:
function anonymous(d) {
    return d.d.__count
}

I can't figure out what I'm missing here?
Kevin Kembel
Top achievements
Rank 1
 answered on 06 Jul 2014
2 answers
171 views
I am working on a project where Kendo UI SPA is a good fit.  I use Visual Studio as my development environment and found the Kendo UI SPA project template for Visual Studio 2013.  Unfortunately I am a VB programmer and the project template is only available for C#.

Do you expect to have a VB version soon or is there perhaps a way to convert the C# project to a VB.Net project?
Phil H.
Top achievements
Rank 2
 answered on 04 Jul 2014
15 answers
3.9K+ views
Any timeframe on when you hope to update the NuGet package to incorporate the 2012.1.515 release?
adRom
Top achievements
Rank 1
 answered on 04 Jul 2014
3 answers
144 views
Hi:

I am experiencing a jQuery error: Object doesn't support property or method 'apply', when I click on the button:
<script id='newButton-template' type='text/x-kendo-template'>
  <button class='k-button' data-bind='click: newProduct'><span class='k-icon k-i-plus'></span> New</button>
</script>
<div id='newProdView'>
</div>
<script type="text/javascript">
  var newProdViewModel = kendo.observable({
     newProduct: function (vm) {
       // vm is the view model
       alert(vm.target.innerText);
     }
  });
  var newTemplate = new kendo.View('newButton-template');
  newTemplate.render("#newProdView", newProdViewModel);
</script>

Phil
Phil H.
Top achievements
Rank 2
 answered on 04 Jul 2014
1 answer
93 views
I've created a sample application to illustrate the behavior here: http://trykendoui.telerik.com/ixuz

The gist of my problem is this:
If I have a string property on a model I can call model.set("property", "some value") and the view will be updated with the change.
If I have an array property on a model and call model.set("array", []) the view and the model become disconnected and no changes to the model will be reflected in the view.

In the sample application if you click the Add button next to the "List Items" heading you'll see new items added. This is done by calling model.items.push({...}).
If you click on the Reset button the code invokes a model.set("items", []) and the view is stuck in the current state. No more changes occur, though you can observe that model.items is changing by checking it's state from the console.

In contrast, if you click the Change button next to the "String Property" heading the code will invoke a model.set("property", "...") which does update the view correctly.

What is the proper way to re-initialize array members on an MVVM model?
Petyo
Telerik team
 answered on 04 Jul 2014
6 answers
233 views
I thought this was one of the most straightforward services offered by this component, but it comes out it is a very tough functionality, to offer.
So, to recap, what is a lookup combobox?
We have a model in input, where there is some sort of id (for example, int? IDProduct, for a table in the database where I have Products(ID, Name): it is nullable because the db field can be non-mandatory, of course).
If we are editing a new record, the value in the model is obviously missing, while if I'm editing a record, the field can or cannot have a specific value.
When showing the combo in the page, if the backing model has a value for the id, we would like to show the corresponding description of the product, otherwise the combo is void.
In each case, when we start typing in the field, after the specified number of chars, a search on the server is started to show the dropdown with the corresponding records.
We select one of the items, so fixing the whole text in the combo and recording a new value for the backing IDProduct (for example, in an observable object, or directly inside the control), and when we submit the page, we send the value to the server.
Lookup comboboxes have always existed in every good user interface library for handling db data, but, for what I could read, study, and try, it's not easily done with this component.
There are the datasource, the transport, the additionaldata, filter parameters, autobind true or false, the binding of a numeric value that becomes initially also the text shown in the combo, since there are not still values in the inner cache, and so on...
I opened tickets, and solved problems one at a time, but in each case, I fixed a problem just to open another, never closing the gap to obtain a really functioning solution.
Is there anyone who wrote some *real* code that can help me, with this problem?
I find very strange that Telerik didn't make a complete sample for this behaviour, that is *really* one of the basic, and most needed, functionalities for a component like this?
Or am I missing something really important???
Please help me, I'm tired and stuck... :-(
Andrea
Andrea
Top achievements
Rank 1
 answered on 04 Jul 2014
5 answers
506 views
Would you happen to have an example of using ajax in a client template? I have the following
columns.Template(c => @Ajax.ActionLink(c.UserName.ToString(), "GetPerson", "Home", null, new AjaxOptions { UpdateTargetId = "result" }, null)).Title("Index")
           .ClientTemplate("<a href='/Admin/Admin/GetUserRoles/#=UserName#'>#=UserName#</a>");

If I change my datasource to server() it works however my paging and editing cease working. When I change my datasource back to ajax everything else works but the parm I'm trying to my ActionMethod keeps returning null. Thanks.
Daniel
Telerik team
 answered on 04 Jul 2014
3 answers
496 views
Hello , 

When i load image image loader of your Text Editor my existing image is not showing up.  I am sure that my file path is correct but the image Thumbnail is not showing properly.  

I used used  thumbnail  but is now showing our current images.  Please check my code and screenshot attache herewith. 

01.settingOptions: {
02.                                                    tools: [
03.                                                            "bold",
04.                                                            "italic",
05.                                                            "underline",
06.                                                            "strikethrough",
07.                                                            "justifyLeft",
08.                                                            "justifyCenter",
09.                                                            "justifyRight",
10.                                                            "justifyFull",
11.                                                            "insertUnorderedList",
12.                                                            "insertOrderedList",
13.                                                            "indent",
14.                                                            "outdent",
15.                                                            "createLink",
16.                                                            "unlink",
17.                                                            "insertImage",
18.                                                            "subscript",
19.                                                            "superscript",
20.                                                            "createTable",
21.                                                            "addRowAbove",
22.                                                            "addRowBelow",
23.                                                            "addColumnLeft",
24.                                                            "addColumnRight",
25.                                                            "deleteRow",
26.                                                            "deleteColumn",
27.                                                            "viewHtml",
28.                                                            "formatting",
29.                                                            "fontName",
30.                                                            "fontSize",
31.                                                            "foreColor",
32.                                                            "backColor"
33.                                                            ],
34.                                                    imageBrowser: {
35.                                                       messages: {
36.                                                        dropFilesHere: "Drop files here"
37.                                                       },
38.                                                       schema: {
39.                                                          data: function(response){
40.                                                              //alert(response.toSource());
41.                                                              return response.data;
42.                                                          },
43.                                                          total: 'total',
44.                                                         //model: settingObj.model
45.                                                      },
46.                                                      //path: "<?php echo $this->preferences_data['file_path_articles_image']; ?>",
47.                                                      transport: {
48.                                                            read: {
49.                                                                type: "POST",
50.                                                                dataType: "json",
51.                                                                url: "<?php echo $this->url( array('module' => 'Portfolio','controller' => 'frontend', 'action' => 'grid' ), 'adminrout',    true) ?>",
52.                                                                data: {
53.                                                                            preferences_table           :   true,
54.                                                                            table_name                  :   "articles_preferences",
55.                                                                            primary_id_field            :   "id",
56.                                                                            primary_id_field_value      :   "1",
57.                                                                            primary_file_field          :   "",
58.                                                                            file_content                :   "",
59.                                                                            file_path_field             :   "file_path_articles_image",
60.                                                                            file_path_articles_image    :   "<?php echo $this->preferences_data['file_path_articles_image']; ?>",
61.                                                                            file_extension_field        :   "file_type",
62.                                                                            file_max_size_field         :   "file_size_max"
63.                                                                        }
64.                                                            },
65.                                                            destroy: {
66.                                                                url: "/kendo-ui/service/ImageBrowser/Destroy",
67.                                                                type: "POST"
68.                                                            },
69.                                                            create: {
70.                                                                url: "/kendo-ui/service/ImageBrowser/Create",
71.                                                                type: "POST"
72.                                                            },
73.                                                             
74.thumbnailUrl: "<?php echo $this->serverUrl().$this->baseUrl().'/'.$this->preferences_data['file_path_articles_image']; ?>",


Now , please check the screenshot and I need your help how can we load the existing image to thumbnail ? 

Dimo
Telerik team
 answered on 04 Jul 2014
1 answer
154 views
I am trying to disable the kendo combobox.

    $("#comboBoxid").kendoComboBox({
                                                            enable: false
                                                        });

this makes the _current property and datasource's data property  null.
 $("#comboBoxid").data(constKendoComboBox).current() is null.

How do I stop this? I don't want to delete the data attached to the kombobox.
subrat
Top achievements
Rank 1
 answered on 04 Jul 2014
1 answer
1.0K+ views
I have a grid that uses a ClientDetailTemplate.  The template is defined as: 

<script id="plan_client_template" type="text/kendo-tmpl">
 
    @(Html.Kendo().Grid<Rep.Models.BuildingChangeValidationViewModel>()
          .Name("CVGrid")
          .Scrollable()
          .Selectable()
          .Editable(editable => editable.Mode(GridEditMode.InLine))
          .Columns(columns =>
          {
              columns.Bound(b => b.Field);
              columns.Bound(b => b.BuildingChangeValidationStatusType).ClientTemplate("#=BuildingChangeValidationStatusType.Value#").Width(250);
              columns.Command(command => command.Custom("Update").Click("updateValidation"));
              columns.Command(command => { command.Edit(); }).Width(172);
          })
          .DataSource(dataSource => dataSource
              .Ajax()
                .Model(model =>
                {
                    model.Id(b => b.BuildingId);
                    model.Field(b => b.BuildingChangeValidationStatusType).DefaultValue(
                        ViewData["defaultBuildingChangeValidationStatuses"] as Rep.Common.LookupItem);
                })
              .PageSize(5)
            .Read(read => read.Action("BuildingValidations_Read", "Plan", new { buildingId = 0 }))
            .Update(update => update.Action("BuildingValidations_Update", "Plan"))
 
          )
          .ToClientTemplate()
    )
</script>

Note that a column uses a ClientTemplate.  The client template is simply a dropdown list. However, the grid is unable to locate the client template and instead returns the error:  "Uncaught ReferenceError: BuildingChangeValidationStatusType is not defined"

However, If I remove the detail grid from the Client Detail Template and put it in a div alongside the parent grid, and remove the ".ToClientTemplate()" call, it works perfectly. So there's something about placing a grid containing a column client template inside of a parent grid's client detail template that make it not work.  Any ideas? 

Dimiter Madjarov
Telerik team
 answered on 04 Jul 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
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?