Telerik Forums
Kendo UI for jQuery Forum
3 answers
503 views
Hi,
Can i enable/disable checkbox of an item from a parametrer passed in the datasource?

for example:
i set my treeview with: 
checkboxes: {
                    checkChildren: true
                },
in the:
   dataSource: [{ ... }]

can i pass a parametrer for set the checkbox disable on that item? (or i can do not show a checkbox for that item)

thank you




Alex Gyoshev
Telerik team
 answered on 16 Jan 2013
2 answers
842 views
Hi,
i have create a datetimepicker, i put depth: year
i want that when i select the month in the value appear the last day of the selected month and not the first day..

i select Jan   value: 01/01/2013  so i want that when i select a month in the value there is  31/01/2013  <- so the last day.

somebody know how to do?

Thank you
Francesco
Top achievements
Rank 1
 answered on 16 Jan 2013
2 answers
251 views
i have inline editing grid with datepicker. This is working fine if i use local database(PC database) but not working if i use remote database


shared/editortemplate/DateTime.cshtml

@model DateTime?


@(Html.Kendo().DatePickerFor(m => m).Format("M/dd/yyyy"))



View:
columns.Bound(p => p.DateCompleted).Format("{0:d}").Width(80)       

Model:
 [UIHint("Date")]
 [DisplayName("Date Completed")]
 public DateTime? DateCompleted { get; set; }
when i tried to update and pick another date the tried to save, the date value become null and it weird is only happen if i connect via remote database



please advise
Vladimir Iliev
Telerik team
 answered on 16 Jan 2013
6 answers
2.5K+ views

            var dropdownDataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "Tenant/ProductList",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        type: "post"
                    }
                },
                schema: {
                    model: {
                        id: "ProductID",
                        fields: {
                            ProductID: { editable: false, nullable: true },
                            ProductName: { editable: false }
                        }
                    }
                }
            });

            var dropDownList = $("#ProductList").kendoDropDownList({
                optionLabel: "Select product...",
                name: "ProductID",
                dataTextField: "ProductName",
                dataValueField: "ProductID",
                dataSource: dropdownDataSource
            }).data("kendoDropDownList");


At this point dropDownList = undefined??

 

Alexander Valchev
Telerik team
 answered on 16 Jan 2013
3 answers
414 views
How can I keep the selected item selected after a collapse then expand?

@{   
    if (Session["VendorList"] != null)
    {
        List<PA.Service.AdminTools.VendorDTO> vendors = (List<PA.Service.AdminTools.VendorDTO>)Session["VendorList"];
        
        @(Html.Kendo().PanelBar()
            .Name("Vendors")
            .ExpandMode(Kendo.Mvc.UI.PanelBarExpandMode.Multiple)
            .Items(panelbar =>
            {
                panelbar.Add().Text("Vendors")
                    .Expanded(true)
                    .Enabled(true)
                    .Items(items =>
                    {
                        foreach (var vendor in vendors)
                        {
                            if (vendor.IsDefault)
                            {
                                items.Add()
                                    .Text(vendor.VendorName)
                                    .HtmlAttributes(new { onclick = "SetVendorID("+vendor.VendorID.ToString()+")" })
                                    .Selected(true);
 
                            }
                            else
                            {
                                items.Add()
                                    .Text(vendor.VendorName)
                                    .HtmlAttributes(new { onclick = "SetVendorID(" + vendor.VendorID.ToString() + ")" })
                                    .Selected(false);
                            }
                        }
                    });
            })            
        )    
    }  
 }
Daniel
Telerik team
 answered on 16 Jan 2013
1 answer
340 views
We have implemented localized validation attributes which inherit form Data Annotations attributes and pull required validation strings from resource DLLs. For example, we have [RequiredLocalized] which inherits from RequiredAttribute. Everything works fine with MVC form fields, we get translated error messages when validating client-side and server-side (when JS turned off).

But when editing field values in Kendo Grid, our own RequiredLocalized validator does not seem to work client-side - invalid data get sent to the server, then the MVC validates the model and rejects it, and only then the error is returned to client.

How do we tell Kendo Grid to use our RequiredLocalized attribute in Javascript the same way as it uses [Required] ?

Also we see that Telerik Javascript files have some hard-coded validation strings, like "must be a number". Hiow do we localize these?

 
Daniel
Telerik team
 answered on 16 Jan 2013
12 answers
1.4K+ views
Hi Folks,
I have been on with this problem since morning.

I am trying to use the Kendo UI Auto-complete.

Given below are the scripts that I include
<script type="text/javascript" src="~/Scripts/kendoui/kendo.all.min.js"></script><link href="content/kendoui/kendo.common.min.css" rel="stylesheet" />
<link href="content/kendoui/kendo.default.min.css" rel="stylesheet" />

Given below is the HTML code picked up from the demo and slightly modified.

<div id="example" class="k-content">
            <div id="vendors">
                <input id="searchQuery"/>
            </div>
            <script>
                $(document).ready(function () {
                    $("#searchQuery").kendoAutoComplete({
                        minLength: 3,
                        dataTextField: "Name",
                        dataSource: {
                            minLength: 3,
                            type: "json",
                            transport: {
                                read: {
                                    url: "http://localhost:2168/Search.svc/SearchVendorsByName",
                                    dataType: "json",
                                    type: "GET",
                                    contentType: "application/json",
                                },
                                parameterMap: function (options) {
                                    return "searchQuery=" + $('#searchQuery').val();
                                },
                            }
                        }
                    });
                });
            </script>
            <style scoped>
                #vendors {
                    width: 369px;
                    height: 71px;
                    padding: 211px 0 0 141px;
                    margin: 30px auto;
               }
                .k-autocomplete {
                    width: 240px;
                    vertical-align: middle;
                }
            </style>
        </div>


Given below is the format of the data that is returned.

[{"ID":1,"Name":"Vendor Name"},{"ID":2,"Name":"Vendor Name"},{"ID":3,"Name":"Vendor Name"},{"ID":4,"Name":"Vendor Name"},{"ID":5,"Name":"Vendor Name"},{"ID":6,"Name":"Vendor Name"},{"ID":7,"Name":"Vendor Name"},{"ID":8,"Name":"Vendor Name"},{"ID":9,"Name":"Vendor Name"},{"ID":10,"Name":"Vendor Name"}]


The remote service is getting properly called and I also get the data (I viewed it using Fiddler).

However,
Even though the matching data is received the auto-complete dropdown just does not show anything. What am I missing?

Please help me on this. I am pretty sure I am missing something extremely simple.

Thanks in advance.
Georgi Krustev
Telerik team
 answered on 16 Jan 2013
1 answer
103 views
Hello Kendo guys,

Great framework! 
However, I'm having issues related with IE7 like sprites showing in the background on hovering, displacement of windows etc...
Could you please take a look at www.snickers-online.be/werk ?
Using IE8+, Chrome and Safari (on PC, not on iPad), the site shows fine. Using IE 7, the site is not usable at all.

Thank you in advance,

Wim
Kamen Bundev
Telerik team
 answered on 16 Jan 2013
3 answers
601 views
Hi,

We want to send the list of checked node IDs in a treeview to the controller.
We are facing an issue when we check the parent node, we are not able to retrieve the children node IDS for the checked parent node.
This is because we are using the treeviews on change event of checkbox.
When we check the parent node, the children nodes would not have been checked by then in onchange event of treeview.
We want some post node selection event so that by then children nodes wouild have been checked automatically by default and we get their node IDs.
We tried using databound or requestend events,we were not able to capture the children node IDs.

we are getting the node IDs this way.
var checkedNodes=$("input:checked",treeview)

Please help.!

Thanks.!
Vladimir Iliev
Telerik team
 answered on 16 Jan 2013
1 answer
162 views
I'm using a Detailview grid that has a custom popup editor with an upload widget. When I hit edit, the popup displays as expected and I can upload a file. On successful file upload the popup window automatically closes (I would like to stop this from happening) and I get an exception "Uncaught TypeError: Object 1 has no method 'unbind'" in kendo.all.min.js, line 11.

Anyone have any ideas on what could be causing the exception and how to stop the popup window from closing once the upload is complete? I've been fighting with this all day and am no closer to finding a solution...

For reference I'm using KendoUI v2012.3.1304, below is the source code in all its hacked up glory.


@model List<MMWIDPlus.Areas.Admin.Models.ApplicationViewModel>

@section head {
    <script type="text/javascript">
        function KendoGrid_Error(e) {
            var window = $("#window").kendoWindow({
                width: '350px',
                height: '150px',
                modal: true
            }).data("kendoWindow");

            if (e.errorThrown.indexOf("authorized") > -1) {
                $("#ApplicationCategoryGrid").hide();
                $("#ApplicationGrid").hide();

                window.title("Authorization Error");
                window.content("<div style=\"background: url( '../images/lock-icon_32x32.png' ) no-repeat; padding-left: 40px;\">" + e.errorThrown + "</div><div style=\"text-align:right;\"><input type=\'button\' id=\'close\' value=\'Ok\' />");
            } else {
                window.title("Error");
                window.content("<div style=\"background: url( '../images/App-warn-icon_32x32.png' ) no-repeat; padding-left: 40px;\">" + e.errorThrown + "</div><div style=\"text-align:right;\"><input type=\'button\' id=\'close\' value=\'Ok\' />");
            }

            $("#close").click(function () {
                $("#window").data("kendoWindow").close();
            });

            window.center();
            window.open();
        };

        $(document).ready(function () {
            var applicationCategoryDataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: '@Url.Action( "ApplicationCategoryList", "Applications", new {
                             @Area = "Admin"
                         } )',
                        type: 'post',
                        dataType: 'json'
                    },
                    create: {
                        url: '@Url.Action( "CreateApplicationCategory", "Applications", new {
                             @Area = "Admin"
                         } )',
                        type: 'post',
                        dataType: 'json'
                    }
                },
                schema: {
                    model: {
                        Id: 'Id',
                        fields: {
                            Title: { type: 'string' },
                            Description: { type: 'string' }
                        }
                    }
                },
                error: KendoGrid_Error,
                pageSize: 10,
                serverPaging: true,
                serverFiltering: false,
                serverSorting: false
            });

            var applicationDataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: '@Url.Action( "ApplicationList", "Applications", new {
                             @Area = "Admin"
                         } )',
                        type: 'post',
                        dataType: 'json'
                    },
                    create: {
                        url: '@Url.Action( "CreateApplication", "Applications", new {
                             @Area = "Admin"
                         } )',
                        type: 'post',
                        dataType: 'json'
                    },
                    update: {
                        url: '@Url.Action( "UpdateApplication", "Applications", new {
                             @Area = "Admin"
                         } )',
                        type: 'post',
                        dataType: 'json'
                    },
                    destroy: {
                        url: '@Url.Action( "DeleteApplication", "Applications", new {
                             @Area = "Admin"
                         } )',
                        type: 'post',
                        dataType: 'json'
                    }
                },
                schema: {
                    model: {
                        id: 'Id',
                        fields: {
                            ApplicationCategoryId: { type: 'number' },
                            ApplicationCategoryTitle: { editable: false, type: 'string' },
                            Id: { editable: false, type: 'number' },
                            Title: { type: 'string' },
                            Icon: { type: 'string' },
                            Description: { type: 'string' },
                            Timestamp: { editable: false, hidden: true },
                            URL: { type: 'string' }
                        }
                    }
                },
                error: KendoGrid_Error,
                pageSize: 10,
                serverPaging: true,
                serverFiltering: false,
                serverSorting: false
            });

            $("#ApplicationCategoryGrid").kendoGrid({
                columns: [
                    { field: 'Title', title: 'Title', type: 'string', width: 200 },
                    { field: 'Description', title: 'Description', type: 'string' }
                ],
                dataSource: applicationCategoryDataSource,
                detailTemplate: kendo.template($("#template").html()),
                detailInit: detailInit,
                editable: {
                    mode: 'popup',
                    create: true,
                    update: false,
                    destroy: false,
                },
                height: $(document).height() - 350,
                navigatable: true,
                pageable: {
                    pageSize: 10,
                    input: true,
                    previousNext: true,
                    refresh: true,
                    info: true,

                },
                resizable: true,
                scrollable: true,
                sortable: true,
                toolbar: [
                    'create'
                ]
            });

            function detailInit(e) {
                var detailRow = e.detailRow;

                detailRow.find("#ApplicationGrid").kendoGrid({
                    dataSource: applicationDataSource,
                    editable: {
                        mode: 'popup',
                        create: true,
                        update: true,
                        destroy: true,
                        template: $("#popup_editor").html(),
                    },
                    edit: function (e) {
                        $("#IconUpload").data("kendoUpload").bind("upload", function (e) {
                            e.data = { Id: $("#Id").val() }
                        });

                        $("#IconUpload").data("kendoUpload").bind("success", function (e) {
                            applicationDataSource.read(); // Can probably remove this when the "Object has not method called 'unbind' error is fixed.
                        });
                    },
                    scrollable: false,
                    sortable: {
                        mode: 'multiple',
                    },
                    pageable: {
                        pageSize: 10,
                        input: true,
                        previousNext: true,
                        refresh: true,
                        info: true,

                    },
                    resizable: true,
                    navigatable: true,
                    toolbar: [
                        "create"
                    ],
                    columns: [
                        { template: '<img src="#=Icon#" alt="#=Icon#" width="100%" />', title: 'Icon', width: 80 },
                        { template: '<div style="font-weight:bold;">#=Title#</div><div>#=Description#</div><div><a href="#=URL#" target="_blank">#=URL#</a>', title: 'Details', width: 300 },
                        { command: ['edit', 'destroy'], title: 'Action', width: 180 }
                    ]
                });
            }
        });

        function resizeGrid() {
            var gridElement = $("#ApplicationCategoryGrid");
            var dataArea = gridElement.find(".k-grid-content");
            var newGridHeight = $(document).height() - 350;
            var newDataAreaHeight = newGridHeight - 65;
            dataArea.height(newDataAreaHeight);
            gridElement.height(newGridHeight);
            $("#ApplicationCategoryGrid").data("kendoGrid").refresh();
        }

        $(window).resize(function () {
            resizeGrid();
        });
    </script>
}

<div id="window" style="display: none;"></div>

<div id="ApplicationCategoryGrid"></div>

<script type="text/x-kendo-template" id="template">
    <div id="ApplicationGrid"></div>
</script>

<script id="popup_editor" type="text/x-kendo-template">
<input type="hidden" name="Id" id="Id" data-bind="source:Id">

<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <th scope="row">Title:</th>
        <td>
            <label for="Title"></label>
            <input type="text" name="Title" id="Title" data-bind="source: Title">
        </td>
    </tr>
    <tr>
        <th scope="row">Description:</th>
        <td>
            <label for="Description"></label>
            <input type="text" name="Description" id="Description" data-bind="source:Description">
        </td>
    </tr>
    <tr>
        <th scope="row">URL:</th>
        <td>
            <label for="URL"></label>
            <input type="text" name="URL" id="URL" data-bind="source:URL">
        </td>
    </tr>
    <tr>
        <th scope="row">Icon:</th>
        <td>
            <label for="Icon"></label>
            <img src="#=Icon#" alt="#=Icon#" width: 60px;>#=Icon#</a>
            <input type="hidden" name="Icon" id="Icon" data-bind="source:Icon">
            <input type="file" name="IconUpload" id="IconUpload" data-role="upload" data-async='{saveUrl:"@Url.Action( "UploadApplicationIcon", "Applications", new {
                                                                                                                                 @Area = "Admin"
                                                                                                                             } )", autoUpload:"false"}'
        </td>
    </tr>
    <tr>
        <th scope="row">Category:</th>
        <td>
            <label for="Category"></label>
            <select name="ApplicationCategoryId" id="ApplicationCategoryId" data-bind="source:ApplicationCategoryId" />
        </td>
    </tr>
</table>
</script>
Ben
Top achievements
Rank 1
 answered on 15 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?