Telerik Forums
Kendo UI for jQuery Forum
1 answer
166 views

Hi,

I'm trying to build a kendo window which includes both grid and multiselect controls, 
and to allow by double clicking on a row in the grid to add the clicked item to the multi select (Lets say that "id is the value and "name" is the text).
After clicking on the item in the grid I'm trying to append this new value  to the multi select using its api (using the "value" function).
Afterwards,  I remove some of the values I've just added using the control itself (clicking on the "X" of the item) and adding the same items again.
The initial dataSource of the multi select control is an empty array, while it's being changed when new values are added.
I check if the new value I just got from the grid is already exists in the datasource and in the value array, otherwise I add it first to the datasource and then to the value array.

When I made all the mentioned above, I found out that adding an item which had been removed before will hide/remove all the other items and the control would only display the last item added, while the value array still contains all the other ones.
On the "change" event that is triggered by deleting this item, I watch at the value array and see that it's not been changed (this value is still there).
Performing these steps over and over, the value list apears to have duplicates at the same amount as the selected items from the grid (distinct values).

Thanks
Petur Subev
Telerik team
 answered on 19 Jul 2013
2 answers
75 views
http://jsbin.com/elutuz/4/

If I set the second tab (Sales) to have a data-stretch="true" attribute.  The drawer is not functional on this view. I had my code in a PhoneGap app and noticed a console error related to kendo.currentView.scroller.disable.

Hope that helps.
Kiril Nikolov
Telerik team
 answered on 19 Jul 2013
1 answer
154 views
Hello Support,

We're using DataSource in a stand-alone manner, simply using it as a gateway to and from Web API endpoints.  It's been great for reads.  But now we've come to editing and creating, and we're not having any luck.

Consider the projectsDataService below.  The projectsDataService provides a gateway to an enumerable of Project, which has all of the familiar fields you would expect of a Project class:
01.define('projectsDataService', ['underscore'],
02.    function(_) {
03.        var projectsDataSource = new kendo.data.DataSource({
04.                transport: {
05.                    read: {
06.                        url: "api/projects",
07.                        dataType: "json"
08.                    },
09.                    update: {
10.                        url: "api/projects",
11.                        dataType: "json",
12.                        type: 'PUT'
13.                    }
14.                },
15.                page: 1,
16.                pageSize: 20,
17.                schema: {
18.                    model: {
19.                        location: function() {
20.                            return this.projectAddress.city + ", " + this.projectAddress.state.abbr;
21.                        },
22.                        encodedProjectAddress: function () {
23.                            //implement Strategy pattern for encoding
24.                            var fullAddress = this.projectAddress.streetAddress + ",+" +
25.                                this.projectAddress.city + ",+" +
26.                                this.projectAddress.state.abbr;
27. 
28.                            return fullAddress.replace(/ /g, "+");
29.                        },
30.                        multilineProjectAddress: function() {
31.                            var address = [this.projectAddress.streetAddress,
32.                                '<br/>',
33.                                this.location() + '  ' + this.projectAddress.postalCode].join('\n');
34. 
35.                            return address;
36.                        },
37.                        created: function() {
38.                            return moment(new Date(this.createdAt)).fromNow();
39.                        }
40.                    }
41.                }
42.            }),
43. 
44.            getProjects = function (projectsObservableArray) {
45.                projectsDataSource.fetch(function() {
46.                    var dataView = projectsDataSource.view();
47.                    var projects = [];
48.                    _.each(dataView, function (item) {
49.                        
50.                        projects.push(ko.observable(item));
51.                    });
52.                    projectsObservableArray(projects);
53.                });
54.            },
55.             
56.            saveProjects = function() {
57.                projectsDataSource.sync();
58.            };
59. 
60.        return {
61.            getProjects: getProjects,
62.            saveProjects: saveProjects
63.        };
64.    }
65.);
All of the computed-s on the model are available to Knockout, as expected.  Nothing wrong there.  But I have a couple of questions:
  1.   ProjectAddress is a nested complex type, so that I have projectAddress.streetAddress, projectAddress.city, projectAddress.state, etc.  Changes in these properties are, in fact, manifested in the UI (courtesy of Knockout), but changing them doesn't trigger a call to the transport.  In other words, the changes never make it to the server.  I get the sense that DataSource is expecting flattened data.  If so, how do I go about doing that the "DataSource" way?
  2.  Is the fields property necessary on the model, and what is the difference between binding to a field on the model, and binding to a field in the fields property?
  3.   Consider the getProjects() function.  I'm stuffing a knockout array with an array of oversables--the projects.  Should I be making each of Project's properties observable as well in order for the DataSource to pick up on the change?  The problem is that I'm seeing changes in the client, even across multiple screens, ut no call to the server.
  4. Is the "id" property, or field, necessary on the model?
  5. Is it necessary to mapevery property ("field") on the model, or just those that are interesting, as in the code above?
Thank you.

Eric
Alexander Valchev
Telerik team
 answered on 19 Jul 2013
1 answer
75 views
Hello I just downloaded Kendo UI yesterday and I'm evaluating for a PhoneGap app that I'm working on. We have a few views that require a listview that is scrollable independent from the rest of the view (this is a view for tablets). Unfortunately I don't think the splitview would work for us because we also need a footer across the entire app that holds a tab bar. I tried to wrap the listview in a scroller and the listview did hide it's overflow but the list wasn't scrollable. What is the best practice for setting this up?

I have to say I'm pretty impressed so far with the performance and ease of use of the framework. After months of struggling with JQM, I almost wept when I read through the 'layout' API and got a chance to drop a drawer in my app... Almost. I also have one suggestion. I would love to see more information on structuring an app properly. I've just started with requirejs and it seems to be great at pulling the logic into maintainable chunks. More 'best practice' stuff would be incredibly beneficial for intermediate level users that want to make good decisions the first time through.


Petyo
Telerik team
 answered on 19 Jul 2013
14 answers
137 views
I am getting the error "Invalid post content." in Red letters a lot when trying to post to the Kendo Forums.  I am being polite, trying multiple browsers, and pasting things differently. What is the issue I need to address?

Ralitsa Peneva
Telerik team
 answered on 19 Jul 2013
3 answers
1.1K+ views
I have a simple Grid bound to a Model. Works nice. I need to place tool tips, different for each column header, on the grid. I don't see an MVC object to do that though?

@(Html.Kendo().Grid(Model.Items as IEnumerable<Holding>)
                               .Name("KendoCGrid")
                               .Columns(columns =>
                                   {
                                       columns.Bound(e => e.SymbolDescription).Title("Security Name");
                                       columns.Bound(e => e.Symbol).Title("Symbol");
                                       columns.Bound(e => e.SecurityType).Title("Type");
                                   })
                                   .Sortable()
                                   .DataSource(dataSource=>dataSource
                                      .Ajax()
                                      .PageSize(50)
                                      .ServerOperation(false)
                                   )
                                    
                                   
Dimo
Telerik team
 answered on 19 Jul 2013
1 answer
399 views
Hello,

I have a template that am using to show a popup for Grid view. The popup is used to show a list of values that are related to that specific records. In the template I need to be able to post data back to server and close the form without refreshing the whole page.

In the code below if I using Html.BeginForm in the template everything works fine, however the whole page gets a refresh when I click the Save button in the template. So I tried to change it to Ajax.BeginForm in hopes of haveing a partial postback and not refresh the whole page when form is submitted. The second approach result an error in the Java script indicating Invalid Template. I appreciate if you provide some insight.

//Error in Javascript here
var detailsTemplate = kendo.template($("#template").html());

 Here is the Template code:

<script type="text/x-kendo-template" id="template">
@using (Ajax.BeginForm("ModifyRoleForUser", "Account", new { name = "rolesForm" }, new AjaxOptions() { UpdateTargetId = "template", HttpMethod = "POST" }))
{    
    <div id="details-container">
        <input type="hidden" name="UserName" value="#=UserName#" />
        <h3>#= FirstName # #= LastName #</h3>
        <em>Status: #= UserStatusName #</em>
     @(Html.Kendo().MultiSelect()
     .Name("msRoles")
     .Placeholder("Select Role...")
     .Events(e => e.DataBound("onRolesMultiSelectDataBound"))
     .BindTo(ViewBag.RolesList)
     .ToClientTemplate()
     )
    </div>
    <p>
        <input type="submit" value="Save" />
    </p>
}
</script>
Daniel
Telerik team
 answered on 18 Jul 2013
4 answers
486 views
Hi - Just getting started with Kendo and need to post the selected checkboxes from a treeview to an MVC controller.  I was able to get the treeview rendering  with little fuss but am having problems getting the selected checkboxes to post.  The parameter they should map to in my controller action is always null.  Below is what the HTML looks like when my view renders:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>Redacted</title>
    <link href="/Content/bootstrap.css" rel="stylesheet" />
    <link href="/Content/site.css" rel="stylesheet" />
    <script src="/Scripts/jquery-1.9.1.js"></script>
    <script src="/Scripts/jquery.validate.js"></script>
    <script src="/Scripts/jquery.validate.unobtrusive.js"></script>
    <script src="/Scripts/bootstrap.js"></script>
</head>
<body>
    <link href="/Assets/css/kendo/kendo.common.min.css" rel="stylesheet" />
    <link href="/Assets/css/kendo/kendo.default.min.css" rel="stylesheet" />
    <script src="/Assets/js/kendo/kendo.core.min.js"></script>
    <script src="/Assets/js/kendo/kendo.userevents.min.js"></script>
    <script src="/Assets/js/kendo/kendo.data.min.js"></script>
    <script src="/Assets/js/kendo/kendo.treeview.min.js"></script>
    <div class="container">
        <h1>Batch Reporting</h1>
        <div class="accordion" id="reports">
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse" data-parent="reports" href="#dataExtract">Data Extract</a>
                </div>
                <div id="dataExtract" class="accordion-body collapse">
                    <div class="accordion-inner">
                        <form action="/Report/DataExtract" method="post">
                            <div style="height: 300px; overflow-y: scroll">
                                <div id="treeview"></div>
                            </div>
                            <div>
                                <br />
                                <button class="btn  " type="submit">Submit</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $("#treeview").kendoTreeView({
            checkboxes: {
                checkChildren: true,
                name: "checkedItem[]"
            },
            dataSource: [
                {
                    "id": 13, "hasChildren": true, "text": "csd", "items": [
                        {
                            "id": 25, "hasChildren": true, "text": "School", "items": [
                                { "id": 39, "hasChildren": false, "text": "Class 1", "items": null, "expanded": false },
                                { "id": 48, "hasChildren": false, "text": "Class 2", "items": null, "expanded": false },
                                { "id": 90, "hasChildren": false, "text": "Class 3", "items": null, "expanded": false },
                                { "id": 85, "hasChildren": false, "text": "Class 4", "items": null, "expanded": false },], "expanded": false
                        }], "expanded": true
                }]
        });
    </script>
</body>
</html>
The controller action looks like this:
public ActionResult DataExtract(string[] checkedItems)
{
  // Do some really important stuff here...
 
  return RedirectToAction("Index", "Home");
}
Any suggestions as to what I need to do to get the array of selected values would be much appreciated.

Thanks!
Christopher
Top achievements
Rank 1
 answered on 18 Jul 2013
2 answers
192 views
I have a KendoMobileListView with items loaded by endless scroll, with server paging and filtering. Clicking an item leads to a remote mobile view containing its details. The problem is UID seems to get lost/undefined for the previous page items in listview's data source, after a new page has been loaded in the listview.

Found my answer, it seems this is an expected behavior.
http://kendouimobile.com/forums/framework/data-source/getbyuid-returns-undefined-unexpectedly.aspx
Alexandru
Top achievements
Rank 1
 answered on 18 Jul 2013
1 answer
203 views
Hi,

The new set of DataViz controls are looking good, but there's still way too much animation configured by default. Our users tend to like displays to be rendered as rapidly as possible. I've managed to turn off the overall animation for the chart in general, but can't quite see how to turn off the slide animation for the tooltip. Perhaps this is a css level change? People will definitely want to get rid of this btw. Having the tooltip jump from one point to another on mouse movement is absolutely fine.

Thanks,
George
Iliana Dyankova
Telerik team
 answered on 18 Jul 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?