Telerik Forums
Kendo UI for jQuery Forum
3 answers
338 views
Hello,

I have run into a problem when trying to use several ViewModels referencing the same model.
ViewModels and models are all ObservableObjects.
Please, consider the following simple example:

    // observable for model
    var model = kendo.observable({ mf: 0 });      

    // observables for two viewmodels
    var vm1 = kendo.observable({ vmFld1: null });
    var vm2 = kendo.observable({ vmFld2: null });

    // set fields of both viewmodels to the same
    // observable model
    vm1.set("vmFld1", model);
    vm2.set("vmFld2", model);

Both ViewModels bind CHANGE event handlers in ObservableObject.wrap() method.
They are added to the array of CHANGE event handlers of the model and are to be triggered when model field is changed.
E.g. like in the line of code below

    // change the value of model field
    vm1.set("vmFld1.mf", 1);

These event handlers are invoked in a loop of Observable.trigger() method.
But each event handler modifies the e.field in event argument e.

wrap: function(object, field, parent) {
    var that = this;
    …
    (function(field) {           
            ...

            object.bind(CHANGE, function (e) {
                e.field = field +  "."  + e.field;
                that.trigger(CHANGE, e);
            });
    })(field);
    ...
}

It should work just fine for the case when we have a linear chain of nested ObservableObjects, but in my case it is rather a tree with single ObservableObject root. The second ViewModel gets incorrect "path" to changed field in CHANGE event handler.

In example above the first ViewModel gets "vmFld1.mf" in CHANGE event. Then it modifies the path in its handler and the second ViewModel vm2 gets incorrect path "vmFld2.vmFld1.mf". 

As a result, vm2 does not refresh view when View-ViewModel binding is used.

I'm not sure if you already know about this and it might be even already fixed in latest version. But I can look only into available for download open source code which is of 2012.3.1114 version.

I very appreciate if you can resolve this issue. Thank you.

Daniel
Telerik team
 answered on 14 Feb 2013
1 answer
113 views
I have loaded the demo page: http://demos.kendoui.com/web/autocomplete/events.html and that works fine in IE9
I tried to duplicate a problem I was having using jsbin here:http://jsbin.com/uhamom/1/edit

I can't even type in the box.

What am I missing on why I can't even type in the box in IE?  I don't see any script errors and I think I am loading everything correctly.

Ok, quick update on this: http://jsfiddle.net/jmann/MemJr/ I can get it to type (I'm guessing something with jsbin in IE)

Now that being said, when I have suggest: true and highlightFirst: true and I press enter it works great.
If I press enter for an entry that does not match, it launches some random button on the page.  Weird?

I'm hoping it is just a return false or preventDefault issue.  Any one else encountering this in IE only? (works great in Firefox and Chrome)

-me-
Dimiter Madjarov
Telerik team
 answered on 14 Feb 2013
1 answer
107 views
hello,
i've inserted a new column field with grid.options.columns.push({title:"name", field:"field"}).
then i read the datasource and refresh the grid but nothing happens...
The new column field is defined in options.dataSoruce.schema.model.fields but not, at starting grid init , in the options.columns.
dataSource.transport is so defined:  {read: { url: "aaa.json",dataType: "json"  }}
Alexander Valchev
Telerik team
 answered on 14 Feb 2013
1 answer
198 views
I've been searching without success for an example of displaying a user's local files and folders in the Kendo TreeView. Kendo's own TreeView demo fakes it by hard-coding folder and file names, but is there a way to populate it with real folders/files? A number of forum postings have mentioned that a client's file system is typically not accessed in a web application for security reasons, but I have been to plenty of sites that allow uploading of local files, so there must be a way. Does anyone have a jquery example of this? I'm writing an ASP.NET MVC application so we won't be able to access anything client-side from models or controllers, but I'm thinking a script in the view might do the trick. Any help would be appreciated!
Alexander Valchev
Telerik team
 answered on 14 Feb 2013
3 answers
114 views
Hi

Output : Json Data -
[{"id":1,"name":"name","hasData":true},{"id":2,"name":"name123","hasData":false}]

I am seeing two nodes name & name123, but when I click on name node I see another set of name and name123 and this keeps goes as I click. Wondering why the tree nodes are getting created for each click on the node arrow. Am I doing something wrong ?

I have the following View, Controller and Scripts as follows.

Index.chtml

<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
	<link href="@Url.Content("~/Content/kendo/2012.3.1315/kendo.common.min.css")" rel="stylesheet" type="text/css" />
	<link href="@Url.Content("~/Content/kendo/2012.3.1315/kendo.dataviz.min.css")" rel="stylesheet" type="text/css" />
	<link href="@Url.Content("~/Content/kendo/2012.3.1315/kendo.default.min.css")" rel="stylesheet" type="text/css" />
	<link href="@Url.Content("~/Content/kendo/2012.3.1315/kendo.dataviz.default.min.css")" rel="stylesheet" type="text/css" />
	<script src="@Url.Content("~/Scripts/kendo/2012.3.1315/jquery.min.js")"></script>
	<script src="@Url.Content("~/Scripts/kendo/2012.3.1315/kendo.all.min.js")"></script>
	<script src="@Url.Content("~/Scripts/kendo.modernizr.custom.js")"></script>
</link>

@{
    ViewBag.Title = "Data";
}
 
<h2>@ViewBag.Message</h2>
 
<div id="treeview" class="treeview-back"></div>

<script type="text/javascript">    
    $(document).ready(function () {
      buildTree();      
    });
     
    function buildTree() {
        var homogeneous = new kendo.data.HierarchicalDataSource({
            transport: {
                read: {
                    url: "Home/RData",
                    dataType: "json"
                }
            },
            schema: {
                model: {
                    id: "id",
                    hasChildren: "hasData"
                }
            }
        });
 
        $("#treeview").kendoTreeView({
            dataSource: homogeneous,
            dataTextField: ["name"]
        });
    }

Controller

public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Data";
 
            return View();
        }
 
        public ActionResult About()
        {
            return View();
        }
 
        [HttpGet]
        public JsonResult RData()
        {
            List<TModel> sites = new List<TModel>();
 
            TModel tModel = new TModel{id = 1, name = "name", hasData = true};
 
            sites.Add(tModel);
 
            tModel = new TModel { id = 2, name = "name123", hasData = false};
 
            sites.Add(tModel);
 
            var resources = from e in sites
                            select new TModel()
                            {
                                id = e.id,
                                name = e.name,
                                hasData = e.hasData
                            };
            return Json(resources, JsonRequestBehavior.AllowGet);      
 
        }
    }
 
    public  class TModel
    {
        public int id;
        public string name;
        public bool hasData;
    }


Output : Json Data -
[{"id":1,"name":"name","hasData":true},{"id":2,"name":"name123","hasData":false}]

I am seeing two nodes name & name123, but when I click on name node I see another set of name and name123 and this goes on as I keep clicking. Wondering why the tree nodes are getting created for each click on the node arrow. Any idea about this behavior ?
Vladimir Iliev
Telerik team
 answered on 14 Feb 2013
3 answers
178 views
Hi Guys,

I manage to change the background color button in IE 7 by adding  

background-color: #3399FF; in kendo.common.min.css but unfortunately not working in IE 8 or above


* + html .k-button {
    line-height: normal;
  
}
Dimo
Telerik team
 answered on 14 Feb 2013
1 answer
103 views
Hi,

I have put a combo box in one of the cell of kendo grid column. It's working fine in IE but does not work in Google chrome,
in the chrome combo box gets padding while in the IE it does not have any padding.

Please let me know how to resolve this issue in the Google chrome.

Regards,

Poonam
Alexander Valchev
Telerik team
 answered on 14 Feb 2013
2 answers
339 views
Is there any approach to get currently used version of kendoUI?
This could be useful in cases when source code is customized and it's sensitive to some particular version.
Yevhen Poshyvaylo
Top achievements
Rank 1
 answered on 14 Feb 2013
1 answer
85 views
HI im using ASP.NET MVC and i generated a Grid by the following code the problem is that the images are not working infact the .ClientTemplate() isnt working at all is there something that im missing do i need to do something in my model ?

@(Html.Kendo().Grid(Model).Name("TeachersGrid")
    .Columns(columns =>
    {
        columns.Bound(m => m.Title).Title("    ");
        columns.Bound(m => m.First_name).Title("Име")
        columns.Bound(m => m.Second_name).Title("Презиме");
        columns.Bound(m => m.Family_name).Title("Фамилия");
       columns.Bound(m => m.img).ClientTemplate("<img src='#=img#' />");
    })
    .Groupable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .Reorderable(reorder => reorder.Columns(true))
    .Resizable(resize => resize.Columns(true))
)


Daniel
Telerik team
 answered on 14 Feb 2013
1 answer
95 views
Hi to all,
I have a window (name: win1, iframe:true, modal:false, url: /controller/action ) within a button for opening a new WINDOW (name win2). That new window (win2) appears included in the first window (win1) and not in the main page of browser. 
Can I show win2 in the same content of win1 ??
Thanks in advance
Gaetano



Gaetano
Top achievements
Rank 1
 answered on 14 Feb 2013
Narrow your results
Selected tags
Tags
+? 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?