Telerik Forums
Kendo UI for jQuery Forum
1 answer
1.0K+ views
We are having difficulties data-binding the Kendo Grid with an observable array using a custom editor (dropdown) to select a data value.

It seems that the custom editor passes back the new object to the grid as expected but the new object is set to a property in the bound array.

In the example below when I add a new Promotion a new promotion is created in the bound array but the actual Promotion object is set to the Id property i.e.

Promotion.Id.Id & Promotion.Id.DisplayName.

I've created a jsfiddle example to illustrate the issue.

http://jsfiddle.net/rm18xexr/

Also if an edit button is added to the grid and a subsequent update is cancelled the Promotion is deleted from the bound data source.  We have spotted various posts stating that an id: property must be defined so have ensured this is set correctly.
Kiril Nikolov
Telerik team
 answered on 09 Oct 2014
3 answers
151 views
In Editor and File/Image browser you can specify custom function to get data from server, create dir, remove dir, navigate...
You can also send additional data ... because you have configurations for:
  • imageBrowser.transport.read 
  • imageBrowser.transport.read.contentType 
  • imageBrowser.transport.read.data 
  • ...

But for upload there is only uploadUrl available. The browser expect that result from server is {"size":38020,"name":"logo_30.jpg","type":"f"} for example, but my server can not get response like this, but {"Something": ..., "Data": {"size":38020,"name":"logo_30.jpg","type":"f"}, "Additional": "value"}

I really like options that you have with read, create dir, remove dir, navigate:

imageBrowser.transport.create = function(o)
        {          
            $.post("url", params, function(response){o.success(response.Data)});
        };

Is it possible to achieve this for upload? Or at least how can tell editor or stand alone Image/File Browser that result are in response.Data not just in response?

Dimo
Telerik team
 answered on 09 Oct 2014
5 answers
1.5K+ views
I want to set the default filter option to contians or remove all other options. How can I accomplish this?


Code Snippet for Filter Configuration:
// TODO: set default filter operator to [contains]
    .Filterable(filter =>
    {
        filter.Extra(false);
        filter.Operators(op =>
        {
            op.ForString(str => str.Clear());
            op.ForString(str =>
            {
                str.Clear().Contains("Contains");
            });
        });
    })


Full Code:
@using NursingHomeStock.Resources
 
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.Title = GlobalResources.Resident + "/" + GlobalResources.Residence;
}
 
<h2>@ViewBag.Title</h2>
 
@(Html.Kendo().Grid<NursingHomeStock.Models.ResidentViewModel>()
    .Name("AvailablePlaceTypesGrid")
    .Columns(columns =>
    {
        columns.Bound(rvm => rvm.FirstName);
        columns.Bound(rvm => rvm.LastName);
        columns.Bound(rvm => rvm.Sex)
            .ClientTemplate("#if (Sex == 1) { #" + GlobalResources.Male +
                "#} else if (Sex == 2) { #" + GlobalResources.Female +
                "# } #")
            .EditorTemplateName("DropDownListSex");
        columns.Bound(rvm => rvm.BirthDate).Format("{0:dd.MM.yyyy}").EditorTemplateName("Date");
        columns.Bound(rvm => rvm.SocialSecurityNumber);
        columns.Bound(rvm => rvm.Comment);
        columns.Command(command => command.Destroy().Text(GlobalResources.Delete));
    })
    .ToolBar(toolbar =>
    {
        toolbar.Create().Text(GlobalResources.Create);
        toolbar.Save().CancelText(GlobalResources.Cancel).SaveText(GlobalResources.Save);
    })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Pageable(pageable => pageable
        .Refresh(true)
        .PageSizes(new []{ 5, 10, 20, 50, 100})
        .ButtonCount(5))
    // TODO: set default filter operator to [contains]
    .Filterable(filter =>
    {
        filter.Extra(false);
        filter.Operators(op =>
        {
            op.ForString(str => str.Clear());
            op.ForString(str =>
            {
                str.Clear().Contains("Contains");
            });
        });
    })
    .Navigatable() // Tabulator Support
    .Sortable()
    .ClientDetailTemplateId("ResidenceGrid")
    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)
        .Events(events => events
            .Error("App.errorHandler")
        )
        .Model(model =>
        {
            model.Id(e => e.Id);
            model.Field(e => e.Id).DefaultValue(Guid.NewGuid());
        })
        .Sort(sort => sort.Add("LastName").Ascending())
        .Read(read => read.Action("ReadResident", "Resident", new { ViewBag.nursingHomeId }))
        .Update(update => update.Action("UpdateResident", "Resident"))
        .Create(create => create.Action("CreateResident", "Resident", new { ViewBag.nursingHomeId }))
        .Destroy(destroy => destroy.Action("DestroyResident", "Resident"))
    )
    .Events(events => events.DataBound("App.Resident.dataBoundResidenceGrid"))
)
 
<script id="ResidenceGrid" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<NursingHomeStock.Models.ResidenceViewModel>()
          .Name("ResidenceGrid_ResidentId_#=Id#")
          .Columns(columns =>
          {
              columns.Bound(residence => residence.From).Format("{0:dd.MM.yyyy}").EditorTemplateName("Date");
              columns.Bound(residence => residence.To).Format("{0:dd.MM.yyyy}").EditorTemplateName("Date");
              columns.Bound(residence => residence.FirstUsage).Format("{0:dd.MM.yyyy}").EditorTemplateName("Date");
              columns.Bound(residence => residence.FileNumber);
              // columns.Bound(residence => residence.NursingHome).ClientTemplate("\\#=NursingHome.Name\\#");
              columns.Bound(residence => residence.PlaceType).ClientTemplate("\\#=PlaceType.Name\\#");
              columns.Bound(residence => residence.BedCategory)
                .ClientTemplate("\\# if (BedCategory == 1) { \\#" + GlobalResources.OneBed +
                    "\\# } else if (BedCategory == 2) { \\#" + GlobalResources.TwoBed +
                    "\\# } \\#")
                .EditorTemplateName("DropDownListBedCategory");
              columns.Command(command => command.Destroy().Text(GlobalResources.Delete));
          })
          .ToolBar(toolbar =>
          {
              toolbar.Create().Text(GlobalResources.Create);
              toolbar.Save().CancelText(GlobalResources.Cancel).SaveText(GlobalResources.Save);
          })
          .Editable(editable => editable.Mode(GridEditMode.InCell))
          //.Pageable(pageable => pageable.ButtonCount(5))
          .Navigatable()
          .Sortable()
          .DataSource(dataSource => dataSource
              .Ajax()
              .Batch(true)
              .Events(events => events
                  .Error("App.errorHandler")
              )
              .Model(model =>
              {
                  model.Id(residence => residence.Id);
                  model.Field(residence => residence.Id).DefaultValue(Guid.NewGuid());
                  // model.Field(residence => residence.FirstUsage).DefaultValue(DateTime.Now);
                  /*
                  model.Field(residence => residence.NursingHome).DefaultValue(
                      ViewData["defaultNursingHome"] as NursingHomeStock.Models.NursingHomeSmallViewModel
                      );
                  */
                  model.Field(residence => residence.PlaceType).DefaultValue(
                      ViewData["defaultPlaceType"] as NursingHomeStock.Models.PlaceTypeSmallViewModel
                      );
              })
              .Create(create => create.Action("CreateResidence", "Resident", new { residentId = "#=Id#", ViewBag.nursingHomeId }))
              .Read(read => read.Action("ReadResidence", "Resident", new { residentId = "#=Id#" }))
              .Update(update => update.Action("UpdateResidence", "Resident"))
              .Destroy(destroy => destroy.Action("DestroyResidence", "Resident"))
          )
          .ToClientTemplate()
    )
</script>
 
@section scripts
{
    <script type="text/javascript">
        //register custom validation rules
        (function ($, kendo) {
            $.extend(true, kendo.ui.validator, {
                rules: { // custom rules
                    socialsecuritynumbervalidation: function (input, params) {
                        //check for the rule attribute
                        if (input.is("[name='SocialSecurityNumber']") && input.val() != "") {
                            // TODO: Should realized as warning, should not block the save action
                            // return AustrianSocialSecurityNumber(input, "SocialSecurityNumber");
                            return true;
                        }
                        return true;
                    }
                },
                messages: { //custom rules messages
                    socialsecuritynumbervalidation: function (input) {
                        // return the message text
                        return input.attr("data-val-socialsecuritynumbervalidation");
                    }
                }
            });
        })(jQuery, kendo);
 
    </script>
}


Dimiter Madjarov
Telerik team
 answered on 09 Oct 2014
1 answer
237 views
Hi there,

I'm trying to implement the basic tooltip from Kendo UI. The tooltip works perfectly when you load the page and hover over an item for the first time. However, the carat does not show up on all consecutive hovers if your mouse is not in a specific spot - even if your mouse is still on top of the hover item.

What's causing this?

<!DOCTYPE html>
<html>
<head>
    <style>html { font-size: 12px; font-family: Arial, Helvetica, sans-serif; }</style>
    <title>Tooltip not working</title>
</head>
<body>
    <label class="control-label" for="experience">Tooltip</label>
   
    <p class="tooltipItems">
      <a href="" title="test tooltip">Hover over me</a>
      <a href="" title="test tooltip">Me too!</a>
    </p>
   
  <p class="tooltipItems">
      <a href="" title="test tooltip">Me too!</a>
    </p>
   
  <script>
    var tooltip = $(".tooltipItems").kendoTooltip({
      filter: "a",
      position: "top"
    }).data("kendoTooltip");
  </script>
 
 
</body>
</html>
Kiril Nikolov
Telerik team
 answered on 09 Oct 2014
1 answer
65 views
Hi,

I am using kendoGrid() to display data, which receives from database in MVC model.

In this kendoGrid, we included "Edit" feature given by kendoGrid.  But when trying to update the data,  the cursor is going into the controller, but the parameter(model) for that action contains null data. i.e. the data is not getting posted from view to controller.

for your reference, I have attached the code files.

Thanks in advance.

Swarnalatha
Alexander Popov
Telerik team
 answered on 09 Oct 2014
3 answers
914 views
Hi ,

Can you please let me know , how i can download the latest official version of Kendo UI Complete . I have the acount with you but can only see the trial version links .
Can you please provide the full path to me .

Thanks
Sebastian
Telerik team
 answered on 09 Oct 2014
1 answer
544 views
Kendo UI version 2014.2.903

I'm having some Hierarchical data source / tree view headaches, and wondering if I'm just doing this wrong.

Summary: we want a single local fully populated hierarchical data source as our model, so its easy to visit any node in the hierarchy. And, we want a lazy loaded treeview (dom wise, not data wize) on top of it.


I'm attempting to display our data in a treeview, while having a single datasource/model behind it. All data is already local, so I would like to access the model assuming it's already completely loaded. Of course, the treeview should operate lazily, not creating dom elements until the user expands a node. So, we want the datasource fully loaded, but the treeview dom elements lazy. From what I see, this is not possible.

Here is what I see... Maybe I'm doing something wrong...

Our data in this example is about 6000 items structured hierarchically in an array of objects, each of which may have a Children array field.

Manually populating a hierarchical data source with add() / append() takes about 4 extra seconds. Apparently due to wrapping all the objects? This is too slow for our use case.

Also tried using code just like kendo.observableHierarchy which internally creates a fully loaded hierarchical datasource But again, same extra 4 seconds.

Question: is it really slow due to wrapping? Or due to events firing? Is there a way to batch the updates and make it fast? Again, this is all running against local data.

Let's say we were OK with this extra time. I discovered what I think is a bug in the treeview. On expanding a single node, when it encounters such a fully-loaded datasource structure, the treeview creates its dom elements all the way down the structure, NOT just the level that was expanded. This is obviously a non-starter since it very slow to create all those dom elements.

So, instead we're forced to use the hierarchical data source in its natural lazy mode: children are not copied/wrapped from the input data array until you load the Node, which happens for example when a tree item gets expanded.

This lazy loading causes annoyance any time you need to read/write your model:
For example, you want to find an item in the data source (your model) by ID, in order to set some fields on it, so you recursively visit the items starting from the top. When a level is already loaded, you need to access Children (our own field in the model). But when the level is not loaded, you need to access the hierarchical data source's internal copy of the data at children.options.data (this is the data that will eventually be copied/wrapped and put under Children once the level is loaded).

And, checking whether a level is loaded is also kludgy:
The hasChildren seems accurate, so you know if there are children in general. But, the loaded() function seems to be true in some cases, when in fact nothing has been wrapped/copied under Children yet.

So, you need to check node.hasChildren && Children.length. If that fails, then you know you need to access the children.options.data. This obviously makes dealing with the model a pain.

I'm hoping that I'm just doing this wrong and someone can help me understand the right way to do this.

Summary: we want a single local fully populated data source as our model, so its easy to visit any node in the hierarchy. And, we want a lazy loaded treeview (dom wise, not data wize) on top of it.

Thanks,
Ryan
Alex Gyoshev
Telerik team
 answered on 09 Oct 2014
3 answers
231 views
I would like to use Kendo Editors in a Kendo Grid. My goal is to edit directly a concern and press a small button at the editor widget to save the changes. Attached a picture how it should looks like at the end.
Here are the single elements: http://jsfiddle.net/nKRzh/19/

I tried already to add the editors in the grid with that:
<script id="detail-template" type="text/x-kendo-template">
    @(Html.kendo().editor()
      .name("editor")
      .value("<p>initial value</p>")
         .ToClientTemplate()
       )
</script>
 
$("#ConcernList").kendoGrid({
    dataSource: dataSource,
    columns:[
        {
            field:"Text",
            title:"Concerns"
            template: kendo.template($("#detail-template").html()),
        },
    ],     
});

But the result is only normal text fields with no button.
Thanks in advance!

I am using ASP.Net MVC 5 and
Kendo UI version: 2014.2.903
OS: Window 7 64-bit
browser version: Chrome 37.0.2062.124 m (64-bit)



Petur Subev
Telerik team
 answered on 09 Oct 2014
3 answers
376 views
Hi,

We're having a couple of issues with embedding charts into a Kendo tab control.

The first issue is that some radar charts are exceeding the tab content boundary like so:

http://i.imgur.com/VQrJOAk.jpg

We're using the following code to redraw the charts on tab changes:

var onActivate = function (e) {
    if ($(e.contentElement).children('#radarCapability').length !== 0) {
        var radarChart = $('#regionRadarChart').data('kendoChart');
        radarChart.refresh();
    } else {
        // redraw bar charts
        // $(exampleChart).data('kendoChart').refresh();
    }
};
 
var tabStrip = $('#regionTabStrip').kendoTabStrip({ activate: onActivate }).data('kendoTabStrip');

Stranger is that the we have another tab strip with a different radar chart in, which uses identical code - this doesn't have any issues. Another thing to note is that clicking a legend item on the right will redraw the chart correctly (so it fits).

The other issue is quite specific, but we have bullet charts within a table - this table is then an iframe within another page. Under Internet Explorer 8 (Client requirement) we're finding that the chart doesn't fill the table cell and leaves a space at the end. At the bottom of the page we're running the following script:

var prfChart = $('#myPrfChart').data('kendoChart');
prfChart.refresh();

However we're finding that this doesn't seem to help, the issue disappears if we switch to a different tab in the tab strip and back to the bar chart again. Likely caused by the onActivate script above. I've tried nesting the refresh script within $(document).ready() but that doesn't seem to help at all.

Just to confuse matters, if you open the page directly (i.e. not within an iframe) then the charts render correctly. I can only replicate the issue in an iframe using IE8. Is there a better way of getting the charts to refresh/redraw on load?

Thanks
T. Tsonev
Telerik team
 answered on 09 Oct 2014
3 answers
166 views
I have an application that is a standard ASP.NET 4.0 and a need has come up to use the kendo UI mapping interface binding to a geojson database.  I followed the online examples and nothing was displaying.  I then installed the examples (and js and styles directories).  All of the examples I tried worked beautifully except, of course, the one I'm interested which is /examples/dataviz/map/geojson.html  - interestingly the rest of the map examples display perfectly. 
Things I've tried
    - loaded the examples and other directories to a live site, thinking it had something to do with Visual Studio, but to no avail. 
    - ensured I had the latest telerik libraries
    - tried chrome, safari and Firefox as well as IE

I've attached a screenshot of what comes back, but I have to assume since the example works on your site that I have a configuration issue.  Any thoughts?
T. Tsonev
Telerik team
 answered on 09 Oct 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?