Telerik Forums
Kendo UI for jQuery Forum
1 answer
525 views
So, we're evaluating Kendo UI against Dev Express for our next version of Oliver.  Thought I'd test forum support as well!  

I'm having a problem getting my tree view to display folders (rather than the default >).  Probably something simple.  Here's the MVC wrapper - note it's a treeview in a panel:

@(Html.Kendo().PanelBar()
    .Name("panelbar")
    .ExpandMode(PanelBarExpandMode.Single)
    .Items(panelbar =>
    {
        panelbar.Add().Text("Folders")
            .Content(@<text>
            <div id="folderTreeView">
                @(Html.Kendo().TreeView()
                    .Name("treeview")
                    .DataTextField("text")
                    .LoadOnDemand(true)
                    .DataSource(source => 
                        source.Read(read =>
                            read.Action("GetFolders", "documents")
                        )
                    )
                    .Events( events => events
                        .Select( "onTreeItemSelect" )
                    )
                    .Deferred()
                )
            </div>
            </text>);
        panelbar.Add().Text("Batches").Content("Batches? We 'aint got no batches. I don't gotta show you no stinkin' batches!");
        panelbar.Add().Text("Clusters");
        panelbar.Add().Text("Tags");
        panelbar.Add().Text("Exemplars");   

    })
    .Deferred()
)
 
Here's the ajax handler:
        public List<DocTreeItem> GetFolders(int? id)
        {
            if (!id.HasValue)
                id = 0;

            List<DocTreeItem> folders = (from docFolders in _dataContextFactory.OliverDBContext.GetTable<FolderTree>()
                                            where docFolders.ParentFolderId == id 
                                            select new DocTreeItem()
                                            {
                                                id = docFolders.FolderId,
                                                text = docFolders.FolderName + " (" + docFolders.DocCount.ToString() + ")",
                                                hasChildren = docFolders.HasChildren,
                                                spriteCssClasses ="folder"
                                            }).ToList();
            return folders;
        }

where DocTreeItem is:
    public class DocTreeItem
    {
        public int id { get; set; }
        public string text { get; set; }
        public bool hasChildren { get; set; }
        public string spriteCssClasses { get; set; }
    }

What am I doing wrong?  Note, I have to define DocTreeItem instead of using Kendo.TreeViewItem because of a problem with camelCase:  If I return a list of TreeViewItems, kendo js is expecting them in camel case.  But, when I enable camel case via: config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); my grid controls break because the grid model binds to the non-camel case model definition, but when it goes to bind on the client, the ajax call now is sending camel case and so the grid won't find it.  How do you deal with that, also?

Thanks,

Robert

Dimiter Madjarov
Telerik team
 answered on 06 Sep 2013
1 answer
48 views
Since $.Browser is deprecated and $.Support doesn't appear to provide a check for supported content types, what's the best way to deliver device specific content types?

Here are some valid examples;
Flash based content to desktop systems, alternate content to iPads. (Please no flames on Flash, it still has valid uses).

Ad-hoc iPad app installs where you would need an install link for iPad and a download link for other browsers.

This is what I'm currently using;

var agentMatch = navigator.userAgent.match(/(iPhone|iPod|iPad)/);
 window.is_AppleMobile = (typeof(agentMatch) === 'undefined') || (agentMatch === null)?false:true;

Any thoughts?

Kiril Nikolov
Telerik team
 answered on 06 Sep 2013
1 answer
125 views
Hello

I have script manager in my page and am using kendoGrid. I am connecting the grid to the service. When this code runs I get the following error:
SCRIPT5007: Unable to get property 'length' of undefined or null reference
ScriptResource.axd, line 5 character 5907
I've checked the script manager code it is with the endWith, (String.prototype.endsWith=function(a){return this.substr(this.length-a.length)===a})

Thank you for your help
Below is the script used
 
$(document).ready(function () { Sys.Application.add_load(initContactsPage); });
var contactsGrid = null;
function initContactsPage()
{
    var contactsColumns = [{
        field: "CustomerName",
        title: "Name",
        template: '<a class="name" href="ContactDetails.aspx?Id=#=CustomerID#">#=CustomerName#</a>'
    },
    {
        field: "strCustomerNumber",
        title: "Number"
    },
    {
        field: "strMainPhone",
        title: "Phone"
    },
    {
        field: "strCity",
        title: "City"
    },
    {
        field: "strWebsite",
        title: "Web Site"
    }
    ];
    contactsGrid = $("#gvContacts").kendoGrid({
        columns: contactsColumns,
        dataSource: new kendo.data.DataSource({
            pageSize: 10, serverPaging: true, page: 1,
            schema:
                {
                    total: "VirtualTotal",
                    data: "Records"
                },
            transport:
                {
                    read:
                    {
                        url: "/Services/APIService.asmx/ListObjectRecords",
                        type: "POST",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        data: getData()
                    }
                },
            error: function (e)
            {
 
            }
        }),
        groupable: false,
        scrollable: false,
        pageable: true
    }).data("kendoGrid");
}
function searchContacts(page)
{
    contactsGrid.dataSource.page(1);
}
function getData()
{
    var contactsParams = {};
    contactsParams["objectId"] = "C9D9AEC9-F6C2-4EB3-8F00-D32A45A7C4C7";
    contactsParams["textFilter"] = null;
    contactsParams["sortColumn"] = null;
    contactsParams["startIndex"] = 1;
    contactsParams["pageSize"] = 10;
    return JSON.stringify(contactsParams);
}
Alexander Valchev
Telerik team
 answered on 06 Sep 2013
1 answer
154 views
The dataBound event can be wired up by data attribute but dataBinding cannot. Why?
<ul data-role="listview" data-bind="source: exampleData" data-binding="onDataBinding" data-bound="onDataBound"></ul>
<script type="text/javascript">
    function onDataBound (e) {
        console.log("this works");
    }
    function onDataBinding (e) {
        console.log("this doesn't");
    }
</script>
Alexander Valchev
Telerik team
 answered on 06 Sep 2013
2 answers
566 views
Hi , 

I have a Model which have a complex structure/nested objects.
Account object have child objects called Addresses. 

Like Account.Addresses[0].StreetName etc.

How can i set Addresses from editor popup custom template so i get the list from controller to update or insert.

My Controller : 
[HttpPost]
      public ActionResult AccountPopup_Create([DataSourceRequest] DataSourceRequest request, Account account )
      {
          var result;
          return new JsonResult() { Data = result };
      }
 
 
      [HttpPost]
      public ActionResult AccountPopup_Update([DataSourceRequest] DataSourceRequest request, Account account )
      {
          var result;
          return new JsonResult() { Data = result };
      }
My custom Template :

@model  Account
 
 
<table>
    <tr class="nameEditor">
        <td class="editor-label">Dosya Adı
        </td>
        <td class="editor-field">
            @Html.TextBoxFor(model => model.Name, new { disabled = "disabled" })
        </td>
    </tr>
    <tr class="nameEditor">
        <td class="editor-label">Kaynak Adı
        </td>
        <td class="editor-field">
            @Html.DropDownListFor(model => model.SourceId, new SelectList(GetSources(), "IntId", "Name"), new { disabled = "disabled" })
        </td>
    </tr>
    <tr class="nameEditor">
        <td class="editor-label">Kaynak Profil Id
        </td>
        <td class="editor-field">
            @Html.TextBoxFor(model => model.SourceAccountId, new { disabled = "disabled" })
        </td>
    </tr>
    <tr class="nameEditor">
        <td class="editor-label">Vergi Dairesi
        </td>
        <td class="editor-field">
            @Html.TextBoxFor(model => model.TaxOffice, new { disabled = "disabled" })
        </td>
    </tr>
    <tr class="nameEditor">
        <td class="editor-label">Vergi Numarası
        </td>
        <td class="editor-field">
            @Html.TextBoxFor(model => model.TaxNo, new { disabled = "disabled" })
        </td>
    </tr>
    <tr class="nameEditor">
        <td class="editor-label">Web Sitesi
        </td>
        <td class="editor-field">
            @Html.TextBoxFor(model => model.Website, new { disabled = "disabled" })
        </td>
    </tr>
 
    <tr class="nameEditor">
        <td class="editor-label">E-Posta
        </td>
        <td class="editor-field">
            @Html.TextBoxFor(model => model.EMail, new { disabled = "disabled" })
        </td>
    </tr>
    <tr class="nameEditor">
        <td class="editor-label">Telefon Numarası
        </td>
        <td class="editor-field">
            @Html.TextBoxFor(model => model.Tel, new { disabled = "disabled" })
        </td>
    </tr>
    <tr class="nameEditor">
        <td class="editor-label">Fax
        </td>
        <td class="editor-field">
            @Html.TextBoxFor(model => model.Fax, new { disabled = "disabled" })
        </td>
    </tr>
    <tr class="nameEditor">
        <td class="editor-label">Profil ÇeÅŸidi
        </td>
        <td class="editor-field">
            @Html.DropDownListFor(model => model.AccountType, new SelectList(ConfigModel.EnumToSelectList(typeof(AccountType)), "Value", "Text"), new { disabled = "disabled" })
        </td>
    </tr>
    <tr class="nameEditor">
        <td class="editor-label">Senaryo Tipi
        </td>
        <td class="editor-field">
            @Html.DropDownListFor(model => model.ScenarioType, new SelectList(ConfigModel.EnumToSelectList(typeof(ScenarioType)), "Value", "Text"))
        </td>
    </tr>
    <tr>
        <td colspan="2" style="height: 10px;"></td>
    </tr>
    <tr>
        <td colspan="2" style="padding-left: 20px;"><strong>Adres</strong></td>
    </tr>
    <tr>
        <td colspan="2" style="height: 10px;"></td>
    </tr>
    <tr class="nameEditor">
        <td class="editor-label">Bina Adı
        </td>
        <td class="editor-field">
            @Html.TextBoxFor(model => model.Addresses[0].CityName)
        </td>
    </tr>
      <tr class="nameEditor">
        <td class="editor-label">Hesap Adı
        </td>
        <td class="editor-field">
            @Html.TextBoxFor(model => model.Addresses[0].AccountId)
        </td>
    </tr>
       
      <tr class="nameEditor">
        <td class="editor-label">Mahalle Adı
        </td>
        <td class="editor-field">
            @Html.TextBoxFor(model => model.Addresses[0].CitySubdivisionName)
        </td>
    </tr>
       
</table>
My Grid :

@(Html.Kendo().Grid(GetAccounts(AccountType.Customer))
      .Name("accountsGrid")
      .Columns(columns =>
      {
          columns.Bound(Account => Account.Name).HeaderTemplate("Profil Adı").Filterable(filterable => filterable.UI("accountNameFilter")).HtmlAttributes(new { title = " #= Name # " });
          columns.Bound(Account => Account.TaxNo).HeaderTemplate("Vergi No").Filterable(filterable => filterable.UI("taxNoFilter")).Width(120);
          columns.ForeignKey(Account => Account.SourceId, GetSources(), "IntId", "Name").Title("Kaynak Adı").Width(200);
          columns.Bound(Account => Account.AccountType).HeaderTemplate("Hesap Tipi").Width(120);
          columns.Command(command => { command.Edit().Text("Güncelle").UpdateText("Güncelle").CancelText("İptal"); }).Width(105);
      })
                   .Filterable(filterable => filterable
                                .Extra(false)
                    )
                   .ToolBar(toolbar => toolbar.Create().Text("Yeni kayit ekle"))
                   .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("AccountEditPopup"))
                   .Pageable(pager => pager
                   .Messages(messages => messages.Display("{0} - {1}. Toplam {2} kayıt")
                                             .ItemsPerPage("")
                                             .First("İlk sayfa")
                                             .Last("Son sayfa")
                                             .Next("Sonraki")
                                             .Page("Sayfa")
                                             .Previous("Önceki")
                                             .Refresh("Yenile"))
                  )
                  .Sortable()
                  .Scrollable()
                  .Events(e => e.Edit("onEdit"))
                  .ClientDetailTemplateId("template")
                  .DataSource(dataSource => dataSource
                      .Ajax()
                      .PageSize(30)
                      .Model(model =>
                      {
                          model.Id(p => p.IntId);
 
                      })
                      .Events(events => events.Error("error_handler"))
                      .Create(update => update.Action("AccountPopup_Create", "Config"))
                      .Read(read => read.Action("AccountPopup_Read", "Config"))
                      .Update(update => update.Action("AccountPopup_Update", "Config"))
                  )
                                 )
hüseyin altun
Top achievements
Rank 1
 answered on 06 Sep 2013
14 answers
247 views
We are trying to make a button which calls some ajax.  But when it's done we want the content to be scrolled up.  So it's front and center.

we have found this.
/**
 * Scrolls the container to the top.
*/
reset: function() {
      this.movable.moveTo({x: 0, y: 0});
},

with in kendo.mobile.scroller.js

But we have yet to find out how to use the method "moveTo(x,y)"

Any help would be GREAT!!!!! 
John
Top achievements
Rank 1
 answered on 06 Sep 2013
11 answers
1.5K+ views
Does Kendo have a Tooltip plug-in that can be invoked from the grid cell, perhaps opening when the mouse has been in the cell for a specified duration, e.g. 750ms, and then closing when the mouse leaves the cell?


Dimo
Telerik team
 answered on 06 Sep 2013
1 answer
126 views
I am calling three kendo grids on a page. I am using web api to fill data in the datasource. Sometime (not all the time) one of my kendo grid does not load data for an unknown reason. I just see the grid is there without any data in it. When I reload the page I see the data is back. What can be the reason for this problem? What should I do to solve this problem?
Jayesh Goyani
Top achievements
Rank 2
 answered on 06 Sep 2013
2 answers
143 views
I am implementing the date picker in my system, and the control throws an error in jquery library when run using Ie7 and Ie8 compatibility mode.. I run on Ie10

I know there is a thread which discusses the same issue...
http://www.kendoui.com/forums/kendo-ui-web/date-time-pickers/datepicker-use-ie9-compatibility-mode-ie7-or-ie8-day-not-selected.aspx

 it says.. its fixed in the latest version.. i have the latest one (kendoui.web.2013.2.716)... but i still experience the issue..

I took a screen recording and uploaded on youtube..
http://youtu.be/L_ZgDCtZJkA

I am fine, as long as there is a confirmation from telerik team that, it wud work fine on direct Ie7 and 8 browsers and not the compatibility mode... will it?
Chris
Top achievements
Rank 1
 answered on 05 Sep 2013
3 answers
293 views
Is it possible to navigate command buttons on the grid with arrow keys?

http://jsbin.com/ocekUQI/1/edit?html,output

My user would like to be able to navigate the grid with the arrow keys including the command buttons
beauXjames
Top achievements
Rank 2
 answered on 05 Sep 2013
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
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
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?