Telerik Forums
Kendo UI for jQuery Forum
1 answer
81 views
Hi Telerik-Team

I have a very strange issue:
According to your documentation, it's not possible to use the kendo.mobile.min directly with requireJS, which kind of makes sense (and I don't really care because including full featured libs with TypeScript + AMD is a pain anyway).

So what I do is simply load the file normally through the script-tag.
I then can initialize the App from within my modules, use the data- paramters to define behaviours, etc..
Everything works like a charm.

My current view features a lot of widgets, like buttons and scrollview which is kind of my "proove".

But here is the strange thing: when I use requireJS, Touch seams to be the only thing which is not working:
No matter if I declare them with the data-attribute, or through $(element).kendoTouch.

Now, according to your documentation, the "namespace" of the Touch-Widget is kendo.ui.Touch.
That object exists. And I can initialize my touch-behaviour with a new instance of it and that works without any problem.

As soon as I remove requireJS, I can use the touch-widget normally again.
I'm really wondering what could break the Touch-Widget, and as far as I can tell, only the Touch-Widget...

Thanks!
Mihai
Telerik team
 answered on 29 Apr 2014
2 answers
319 views
I have a Listview with two templates, one for show the rows info and another for edit mode. My problem is: every time i click in update or delete always triggers the create event and with cancel delete the row... What I'm doing wrong?

this code is in my view    
<script type="text/x-kendo-template" id="listViewTmpl">
                        <div class="product-view k-widget">
                            <div class="edit-buttons">
                                <a class="k-button k-button-icontext k-edit-button" href="\\#"><span class="k-icon k-edit"></span></a>
                                <a class="k-button k-button-icontext k-delete-button" href="\\#"><span class="k-icon k-delete"></span></a>
                            </div>
                            <dl>
                                <dt>Nominee:</dt>
                                <dd>#:NomineeName#</dd>
                            </dl>
                            <input type="hidden" name="NomineeTitle" value="#:NomineeTitle#" />
                            <input type="hidden" name="NomineeDeptId" value="#:NomineeDeptId#" />
                            <input type="hidden" name="NomineeId" value="#:NomineeId#" />
                        </div>
                    </script>                    
                    <div class="NomineeRight">
                        <a id="addNominee" title="Add Nominee to the list"><img src=@Url.Content("~/img/rnr_add_item.png") alt="Add nominee" /><strong> Add Nominee</strong></a>
                        @(Html.Kendo().ListView<X.Models.NomineeInfo>()
                            .Name("NomineeList")
                            .TagName("div")
                            .ClientTemplateId("listViewTmpl")
                            .Editable(edit => edit.TemplateName("NomineeEditTmpl"))
                                
                            .Events(ev =>
                            {
                                ev.Save("checkData");
                                ev.Cancel("cancelEdit");
                                ev.Remove("removeElem");
                            })
                            .DataSource(dataSource =>
                            {
                                dataSource.Events(ev => ev.Sync("listviewSync"));
                                dataSource.Model(m => m.Id("NomineeId"));
                                dataSource.Create(create => create.Action("NomineeListViewCreate", "Nominate"));
                                dataSource.Read(read => read.Action("NomineeListViewRead", "Nominate"));                               
                                dataSource.Update(update => update.Action("NomineeListViewUpdate", "Nominate"));
                                dataSource.Destroy(destroy => destroy.Action("NomineeListViewDestroy", "Nominate"));
                            })
                        )
                    </div>


this is my edit template
@model X.Models.NomineeInfo
 
<div class="product-view k-widget">
    <div class="edit-buttons">
        <a class="k-button k-button-icontext k-update-button" href="\\#"><span class="k-icon k-update"></span></a>
        <a class="k-button k-button-icontext k-cancel-button" href="\\#"><span class="k-icon k-cancel"></span></a>
    </div>
    <dl>
        <dt>Employee</dt>
        <dd>
            <input type="text" class="k-textbox" data-bind="value:NomineeName" name="NomineeName" style="width:150px"/>
        </dd>
        <dt>Job Title</dt>
        <dd>
            <input type="text" class="k-textbox" data-bind="value:NomineeTitle" name="NomineeTitle" style="width:150px" />
        </dd>
        <dt>Department</dt>
        <dd>
            @(Html.Kendo().DropDownList()
                .Name("NomineeDeptId")
                .SelectedIndex(@Model.NomineeDeptId)
                .HtmlAttributes(new { style = "width:150px" })
                .DataTextField("DeptName")
                .DataValueField("DeptID")
                .OptionLabel("Select a Dept")
                .DataSource(ds => ds
                    .Read(
                            read => read.Action("GetDepartments", "Utility")
                        )
                    )
            )
        </dd>
    </dl>
</div>


js
// validate the information before save
function checkData(elem)
{
    if (elem.model.NomineeName === "")
    {
        elem.preventDefault();
        createNotification("Please enter a valid Nominated Name.", "error");
    }
    else if (elem.model.NomineeDeptId === 0)
    {
        elem.preventDefault();
        createNotification("Please enter a valid Department.", "error");
    }
}
 
// cancel the listview edit mode
function cancelEdit(elem)
{
    //var listView = $("#NomineeList").data("kendoListView");
    //listView.cancel();
 
    elem.preventDefault();
 
    listView.dataSource.read();
}
 
function removeElem(elem)
{
    //var listView = $("#NomineeList").data("kendoListView");
 
    console.log("remove");
    console.log(elem);
}
 
// send the listview to read from server every time it sync
function listviewSync()
{
    this.read();
}



<script type="text/x-kendo-template" id="listViewTmpl">
                        <div class="product-view k-widget">
                            <div class="edit-buttons">
                                <a class="k-button k-button-icontext k-edit-button" href="\\#"><span class="k-icon k-edit"></span></a>
                                <a class="k-button k-button-icontext k-delete-button" href="\\#"><span class="k-icon k-delete"></span></a>
                            </div>
                            <dl>
                                <dt>Nominee:</dt>
                                <dd>#:NomineeName#</dd>
                            </dl>
                            <input type="hidden" name="NomineeTitle"value="#:NomineeTitle#" />
                            <input type="hidden" name="NomineeDeptId"value="#:NomineeDeptId#" />
                            <input type="hidden" name="NomineeId"value="#:NomineeId#" />
                        </div>
                    </script>
                    @*<div class="NomineeLeft">
                        <a id="addNominee"><imgsrc=@Url.Content("~/img/rnr_add_item.png") alt="Add nominee" /><strong>Add Nominee</strong></a>
                    </div>*@
                    <div class="NomineeRight">
                        <a id="addNominee" title="Add Nominee to the list"><img src=@Url.Content("~/img/rnr_add_item.png") alt="Add nominee" /><strong> Add Nominee</strong></a>
                        @(Html.Kendo().ListView<RewardSystemMvc.Models.NomineeInfo>()
                            .Name("NomineeList")
                            .TagName("div")
                            .ClientTemplateId("listViewTmpl")
                            .Editable(edit => edit.TemplateName("NomineeEditTmpl"))
                                //.Pageable(page => page.ButtonCount(1))
                                //.HtmlAttributes(new { style = "height:150px;overflow: auto;" })
                            .Events(ev =>
                            {
                                ev.Save("checkData");
                                ev.Cancel("cancelEdit");
                                ev.Remove("removeElem");
                            })
                            .DataSource(dataSource =>
                            {
                                dataSource.Events(ev => ev.Sync("listviewSync"));
                                dataSource.Model(m => m.Id("NomineeId"));
                                dataSource.Create(create => create.Action("NomineeListViewCreate", "Nominate"));
                                dataSource.Read(read => read.Action("NomineeListViewRead", "Nominate"));                               
                                dataSource.Update(update => update.Action("NomineeListViewUpdate", "Nominate"));
                                dataSource.Destroy(destroy => destroy.Action("NomineeListViewDestroy", "Nominate"));
                            })
                        )
                    </div>
Lienys
Top achievements
Rank 2
 answered on 29 Apr 2014
4 answers
4.5K+ views
I have a combobox bind with ajax to a server method, but I need to empty it when the user selects some options on the UI.

How can I empty the combobox?

Thanks in advance.
Kiril Nikolov
Telerik team
 answered on 29 Apr 2014
3 answers
1.3K+ views
Hi,

I'd like to take advantage of the automatic currency formatting (using the "c" option), but by setting a specific currency symbol. However, I do not want to change the locale (which seems to be the recommended solution), because what I want is not changing the way number is formatted, BUT only the currency symbol.

Is that possible? I've tried several things but with no success.

Thanks!
Georgi Krustev
Telerik team
 answered on 29 Apr 2014
1 answer
135 views
We are using Kendo Dropdown in our project. One of example is:

  @(Html.Kendo().DropDownList()
            .Name("DELFLG")
            .Items(item =>
            {
                item.Add().Text("Ignore").Value("");
                item.Add().Text("Yes").Value("Y");
                item.Add().Text("No").Value("N").Selected(true);
            }).DataTextField("Text").DataValueField("Value").HtmlAttributes(new { style = "width:130px" })
            )    

Select last value in drop down and press key on keyboard which is NOT starting character of any list box item, it prompts script error. This is happening in kendo demo also.

http://demos.telerik.com/kendo-ui/web/dropdownlist/index.html



























Georgi Krustev
Telerik team
 answered on 29 Apr 2014
1 answer
309 views
Hi I am using kendo listview component as seen below:


$("#showHide").kendoListView({dataSource: vals,template: "<div style='overflow: hidden;text-overflow: ellipsis;white-space: nowrap;margin:4px;'>#:name#</div>",selectable: "multiple",
change:  function() {
selected = $.map(this.select(), function(item) {
return vals[$(item).index()].name;
              });     
},
});

Is there any way that i can find the max lenght element of whole content. for example 
1). asdf
2).asdfsadfasdf
3).asdfasdfsadfsadfasdf

In this 3 element is largest.

Please suggest if there is any way we can find the max length of all the elements.
Alexander Popov
Telerik team
 answered on 29 Apr 2014
1 answer
298 views
I'm in the process of creating a big business application using kendo ui. Since application is big. we have started to follow modular patter in javascript code.

When using modular pattern wtih kendo ui. i'm getting some errors.

i have created hierarchy grid. Each grid code will be modular object. like below:

But i'm getting below error: (I have bolded error lines. Please see below)

SCRIPT5007: Unable to get property 'find' of undefined or null reference.

Reason for error is "this" object is referred to window object. But it should refer kendo grid object.. how to resolve this

var Customer = (function ($,window) {
    var gridCustomer = null;
    var dataSource = null;
    var createColumns = function () {
        return [
                    {
                        field: "FirstName",
                        title: "First Name",
                        width: "110px"
                    },
                    {
                        field: "LastName",
                        title: "Last Name",
                        width: "110px"
                    },
                    {
                        field: "Country",
                        width: "110px"
                    },
                    {
                        field: "City",
                        width: "110px"
                    },
                    {
                        field: "Title"
                    }
        ]
    };
    var setDataSource = function () {
        if (customerGridDataSource != undefined) {
            return dataSource = new kendo.data.DataSource({
                data: customerGridDataSource,
                schema: {
                    data: function (response) {
                        return response;
                    },
                    total: function (response) {
                        return response.length;
                    },
                    model: {
                        id: "CustomerID",
                        fields: {
                            CustomerID: { editable: false, nullable: false, type: "int" },
                            FirstName: { editable: true, nullable: false, type: "string" },
                            LastName: { editable: true, nullable: true, type: "string" },
                            Country: { editable: true, nullable: true, type: "string" },
                            City: { editable: true, nullable: true, type: "string" },
                            Title: { editable: true, nullable: true, type: "string" }
                        }
                    }
                },
                pageSize: 5,
                serverPaging: false,
                serverSorting: false
            });
        }
        else {
            alert("Data Source undefined. Please Contact Administrator.")
        }
    };
    var onDataBound = function () {        
        this.expandRow(this.tbody.find("tr.k-master-row").first());
    };

    var init = function () {
        gridCustomer = $("#gridCustomer").kendoGrid({
            sortable: true,
            filterable: true,
            pageable: {
                pageSize: 5,
                pageSizes: true
            },
            columns: createColumns(),
            dataSource: setDataSource(),
            dataBound: onDataBound(),
            detailInit: Order.Init()
        });
    };

    return {
        Init: function () {
            init();
        }
    }
})(jQuery,window);

var Order = (function ($,window) {
    var gridOrder = null;
    var dataSource = null;
    var createColumns = function () {
        return [
                { field: "OrderID", width: "70px" },
                { field: "ShipCountry", title: "Ship Country", width: "110px" },
                { field: "ShipAddress", title: "Ship Address" },
                { field: "ShipName", title: "Ship Name", width: "200px" }
        ]
    };
    var setDataSource = function () {
        if (customerGridDataSource != undefined) {
            return dataSource = new kendo.data.DataSource({
                data: customerGridDataSource,
                schema: {
                    data: function (response) {
                        return response;
                    },
                    total: function (response) {
                        return response.length;
                    },
                    model: {
                        id: "CustomerID",
                        fields: {
                            OrderID: { editable: false, nullable: false, type: "int" },
                            ShipCountry: { editable: true, nullable: false, type: "string" },
                            ShipAddress: { editable: true, nullable: true, type: "string" },
                            ShipName: { editable: true, nullable: true, type: "string" }                            
                        }
                    }
                },
                pageSize: 5,
                serverPaging: false,
                serverSorting: false,
                serverFiltering: false,
                filter: { field: "CustomerID", operator: "eq", value: e.data.CustomerID }
            });
        }
        else {
            alert("Data Source undefined. Please Contact Administrator.")
        }
    };    
    var init = function (e) {
        gridOrder = $("<div/>").appendTo(e.detailCell).kendoGrid({            
            scrollable: false,
            sortable: true,
            pageable: true,
            columns: createColumns(),
            dataSource: setDataSource()
        });
    };

    return {
        Init: function (e) {
            init(e);
        }
    }
})(jQuery,window);

$(function () {
    Customer.Init();
});





Atanas Korchev
Telerik team
 answered on 29 Apr 2014
7 answers
767 views
Hola, tengo un problema al enlazar el evento "change" de un combobox, la función del evento jamás se dispara.

El escenario es el siguiente:

El combobox se carga en una vista parcial con sus datos mediante razor

@Html.Kendo().ComboBox().Name("uiCombobox").Filter("contains").Placeholder("Seleccionar...").DataTextField("Nombre").DataValueField("Id").BindTo(Model.Lista).Suggest(true).HtmlAttributes(new {style="width:500px;"})

En la vista padre se realiza el binding del evento change de la siguiente manera:

var comboboxchange= function (e) {
        var id= this.value();
        alert("Id:" + id);
    }

$(document).ready(function () {
        $("#uiCombobox").kendoComboBox();
        var combobox = $("#uiEventos").data("kendoComboBox");
        combobox.bind("change", comboboxchange);
    });

Al escoger una opción en el combobox nunca se despliega la alerta, pueden ayudarme, gracias.



Georgi Krustev
Telerik team
 answered on 29 Apr 2014
1 answer
132 views
Hi Kendo team,
Your DatePicker/ Customizing templates sample doesn't show any icon in Firefox 28.0
I've attached a picture to see this issue.
Kind regards.

Oscar.
Kiril Nikolov
Telerik team
 answered on 29 Apr 2014
1 answer
217 views
I've created a demo to show how the Kendo DropDownList does not behave like a standard HTML select when using a Reset button. After clicking reset you can see the standard HTML select changes back to "Select..." and the Kendo one does not. I haven't been able to come up with a workaround yet either. Help is appreciated

http://trykendoui.telerik.com/EVIS
Georgi Krustev
Telerik team
 answered on 29 Apr 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
Drag and Drop
Application
Map
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
DropDownTree
ListBox
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
LLM Kit
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?