Telerik Forums
Kendo UI for jQuery Forum
1 answer
305 views
I am attempting to use the Kendo UI MVVM framework with the Kendo UI drag and drop mechanic; But I am having a very difficult time finding out how to get the data dropped out of the `draggable` object.

My code is something like this ... 

var viewModel = kendo.observable {
    Cart : [],
    Items : [
    {
      Id : "item/10",
      Name: "CD ROM"
    },
    {
      Id : "item/11",
      Name: "DVD ROM"
    }
};

So then I have a rough template binding...

<script id="products-template" type="text/x-kendo-template">
    <li class="draggable">
        <div data-bind="text: Name"></div>
    </li>
</script>



Then this gets called up in a list...

 
<div id="shopping-items-available">
    <ul data-template="products-template" data-bind="source: Items">
    </ul>
 </div>


Then there is a standard "drop target" (taken from the kendo docs)

<div id="droptarget">Start dragging.</div>


with the following CSS

 
#droptarget {
     border: 1px solid #959595;
     height: 198px;
     width: 300px;
     font-size: 36px;
     border-radius: 37px;
     text-align: center;
     line-height: 198px;
     color: #a1a1a1;
     text-shadow: 0 1px 1px #fff;
     margin: 0 0 30px 220px;
     cursor: default;
     background: #dddddd;
     background: -moz-linear-gradient(top, #dddddd 0%, #c1c1c1 100%);
     background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dddddd), color-stop(100%,#c1c1c1));
     background: -webkit-linear-gradient(top, #dddddd 0%,#c1c1c1 100%);
     background: -o-linear-gradient(top, #dddddd 0%,#c1c1c1 100%);
     background: -ms-linear-gradient(top, #dddddd 0%,#c1c1c1 100%);
     background: linear-gradient(top, #dddddd 0%,#c1c1c1 100%);
 }


Now in the javascript, I turn the `shopping-items-available` div into a `draggable`.

$("body").kendoDraggable({
   hint: function (target) {
       return $(target).clone().addClass("draggable");
   },
   filter: ".draggable"
});



and lastly, I initialize the drop target.

$("#droptarget").kendoDropTarget({
   drop: droptargetOnDrop
});


but in my code, I cannot seem to get the actual data about the item that was dropped.

function droptargetOnDrop(e) {
   console.log(e);
   $("#droptarget").text("You did great!");
   $(".draggable").removeClass("hollow");
}


So the question is, how can I get the data that should be part of this? Like the name, or the Id? 
Petyo
Telerik team
 answered on 12 Aug 2013
1 answer
170 views
Sorry for the cross-posting but going crazy on this one.

http://stackoverflow.com/questions/18151901/kendoui-datasource-results-in-invalid-json-primitive

So essentially, when I use a Kendo Data Source and send anything in the data: field as part of the transport/read command this is what I see come across in fiddler in the json request.

0=%7B&1='&2=s&3=U&4=s&5=e&6=r&7=n&8=a&9=m&10=e&11='&12=%3A&13='&14=a&15=d&16=m&17=i&18=n&19=%40&20=m&21=a&22=i&23=l&24=.&25=c&26=o&27=m&28='&29=%2C&30='&31=s&32=P&33=a&34=s&35=s&36=w&37=o&38=r&39=d&40='&41=%3A&42='&43=1&44=3&45=1&46=2&47=3&48='&49=%2C&50='&51=s&52=U&53=s&54=e&55=r&56=I&57=D&58='&59=%3A&60='&61=1&62=5&63=3&64=9&65='&66=%2C&67='&68=s&69=C&70=l&71=u&72=b&73=I&74=D&75='&76=%3A&77='&78=1&79='&80=%7D

If I don't use the Kendo Data Source and just a common ajax request I don't see these problems at all.  Just curious if anyone has seen this before.  I must be doing something stupid.

Thanks,

Richard
Richard
Top achievements
Rank 1
Veteran
 answered on 11 Aug 2013
2 answers
120 views
It's seems that after the latest update (v2013.1.716), the loading icon from ListView is showing all the time after doing a search.  Was this the intended behavior? 
The example here http://demos.kendoui.com/mobile/listview/filtering.html#/ behaves the same way. It's kinda misleading...makes you think there's still something out there.
This does not happen in v2013.1.703, or earlier as I recall.
KSBA Techie
Top achievements
Rank 1
 answered on 11 Aug 2013
2 answers
43 views
http://jsbin.com/owilaf/17#/
http://jsbin.com/owilaf/17/edit

Using a simple template like <a>${ProductName}</a> causes the ListView to be buggier. 
Using a more complex one like 
<div class="product">
<img src="../../content/web/foods/#=ProductID#.jpg" alt="#=ProductName# image" class="pullImage"/>
<h3>#:ProductName#</h3>
<p>#:kendo.toString(UnitPrice, "c")#</p>
</div>

paradoxically will make the ListView to behave a bit better.
ScrollView is messed up, ListView the same... I think I'll go back to .703 or .514 even though I need the ListView virtualization. (the GetByUid undefined bug which is fixed only in .716)

KSBA Techie
Top achievements
Rank 1
 answered on 11 Aug 2013
4 answers
71 views
http://jsbin.com/owilaf/17#/
http://jsbin.com/owilaf/17/edit

Using a simple template like
<a>${ProductName}</a>
causes the ListView to be buggier.  Using a more complex one like 
<div class="product"><img src="../../content/web/foods/#=ProductID#.jpg" alt="#=ProductName# image" class="pullImage"/><h3>#:ProductName#</h3><p>#:kendo.toString(UnitPrice, "c")#</p></div>
paradoxically will make the ListView to behave a bit better.
ScrollView is messed up, ListView the same.  I think I'll downgrade to 703 or 514 even t hough I need the ListView virtualization.  (the GetByUid undefined bug which is fixed only in 716)
KSBA Techie
Top achievements
Rank 1
 answered on 11 Aug 2013
8 answers
191 views
I have a listview with a data-source that's setup to get 10 items at a time and perform endless scroll.  This list is basically a chat wall, so when it's first loaded I'll get the most recent 10 posts and if user scrolls down I'll get older posts, etc.  While the user is actively in the list, if a new post arrives I'm simply adding the post to the data source which is then appending the new post to the listview, etc.  However, once I add an item to the data source the endless scroll no longer works when the user scrolls down.

After adding the item to the data source, do I need to set anything else on the data source to keep endless scroll alive.  I'm originally setting the schema.total to zero since the user will basically never reach the end of the data items anyway.
KSBA Techie
Top achievements
Rank 1
 answered on 11 Aug 2013
6 answers
73 views
Hi,
after I have updated my mobile app to kendo Q2 I've had some weird behavior with the "kendoMobileListView" .
Once the list has been loaded the loading image just keeps there spinning, and the data has been shown already. I removed this property and it worked fine and once I've add it again the list made the same issue.
KSBA Techie
Top achievements
Rank 1
 answered on 11 Aug 2013
0 answers
111 views
I have a feeling this has already been asked and answered before, but I could not find any reference information.

I am trying to use a Kendo Web Grid in my Kendo Mobile application.  Everything seems to work OK (no errors that I can find), but the grid does not display properly...it is almost as if the grid is in-place but nothing is displayed.

I am trying to combine the stylesheets as listed below:

        <link href="@Url.Content("~/Content/kendo/2013.2.716/kendo.default.min.css")" rel="stylesheet" type="text/css" />
        <link href="@Url.Content("~/Content/kendo/2013.2.716/kendo.common.min.css")" rel="stylesheet" type="text/css" />
        <link href="@Url.Content("~/Content/kendo/2013.2.716/kendo.mobile.all.min.css")" rel="stylesheet" type="text/css" />

and the supporting JS files as listed below:

        <script src="@Url.Content("~/Scripts/kendo/2013.2.716/jquery.min.js")"></script>
        <script src="@Url.Content("~/Scripts/kendo/2013.2.716/kendo.all.min.js")"></script>
        <script src="@Url.Content("~/Scripts/kendo/2013.2.716/kendo.aspnetmvc.min.js")"></script>

Is there a preferred order?  I have tried alternate orders with no luck.  Is there anything else I can try?

*** EDIT ***

My mistake had nothing to do with CSS files...I had not initialized the mobile application on the page I was trying to use the grid on.  My apologies.
Steven
Top achievements
Rank 1
 asked on 11 Aug 2013
1 answer
148 views
I am attempting to setup a Kendo Grid in AJAX mode, but have some sort of history feature with the browser.  This is so that if the user has sorted/paged the grid then clicks another link then hit's the browser back button to come back to the grid, that they will be given the same set of data they were looking at when they left.

I don't really care about storing every step of the paging/sorting in the browser history (although this is an option), I'm more just interested in doing so when the user clicks on a link that that takes them to a whole new page.  Imagine a search screen with the grid, where a user clicks on a search result, discovers it's not what they were looking for, then presses the back button to get back to the results he was looking at.

I know I could use server side mode of the grid for this, but AJAX appears to be alot faster and I would like to optimize for this performance.

Through my investigation so far, it seems I have some options on how this could be done:

1.  Use the new HTML5 history api
To use this I would need to build up the query string for the paging/sorting and then store that into the browser history.  I could probably do this on the databound event of the grid.  Question on this one would be, is there any way to ask the grid for the query string?  It obviously knows how to build it because it does so in server mode.  It would be nice not having to recreate this code.

2.  Using ASP.NET MVC Session
It seems like I could store some of the paging/sorting information into the session and then retrieve it.  But I would only want it to take effect when the user has pressed the back button.  If they press the Results link directly, it should just go to the default first page, no sorting grid.  Only when they press back should they get the paging/sorting they were using before they left the page.  Does anyone have any idea on how to accomplish this?

3.  Using cookies
Seems like the same basic idea as #2 with the same questions

Any help or ideas would be greatly appreciated! 
Josh
Top achievements
Rank 1
 answered on 09 Aug 2013
1 answer
1.7K+ views
I would like to merge columns for a given row using the "colspan" attribute.  However, this seems to cause a "Cannot read property 'nodeName' of undefined" error. Is there a way to fix this? 

<table>
<thead>

<tr>
<th filter='false'>FIRST NAME</th>
<th filter='false'>LAST NAME</th>
<th filter='false'>STATE</th>
<th filter='false'>GENDER</th>
</tr>
</thead>
<tbody>

<tr>
<td>JOHN</td>
<td>SMITH</td>
<td>VIRGINIA</td>
<td>MALE</td>
</tr>

<tr>
<td colspan="4">
Address Info goes here
</td>
</tr>

</tbody>
</table>
Dimo
Telerik team
 answered on 09 Aug 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?