This is a migrated thread and some comments may be shown as answers.

kendoDraggable filter syntax

4 Answers 182 Views
Drag and Drop
This is a migrated thread and some comments may be shown as answers.
Ozzy
Top achievements
Rank 2
Ozzy asked on 08 Nov 2013, 08:36 AM
Hi,

I would like to know if there is any documentation on the filter parameter for the kendoDraggable function.  I have searched a lot and not found anything.

My current situation is that I have drag and drop working between 2 kendo ui grids and all is great.  However, the draggable filter is currently:
filter: "tbody > tr"
This causes the whole line to then display in the drag.  I would like to find a way to specify the first column in that row and not the whole row.

Any input would be greatly appreciated.

4 Answers, 1 is accepted

Sort by
0
Ozzy
Top achievements
Rank 2
answered on 08 Nov 2013, 08:44 AM
I just found a way to accomplish what I want for now, although I would still like to know how the syntax works for the future.

My current solution was to change my original hint:
hint: function (e) {
    return $('<div class="k-grid k-widget drag" style="width: 300px"><table><tbody><tr>' + e.html() + '</tr></tbody></table></div>');
}
to use a javascript substr to show only the first cell as follows:
hint: function (e) {
    return $('<div class="k-grid k-widget drag" style="width: 300px"><table><tbody><tr>' + e.html().substr(0, e.html().indexOf('</td>')) + '</tr></tbody></table></div>');
}
This resolves my current issue, but my original question still stands. 
0
Kiril Nikolov
Telerik team
answered on 11 Nov 2013, 01:08 PM
Hello Ozzy,

In the filter and hint configuration options you pass a valid jQuery selector that will be used to select the elements that you want to operate with. You can check the following article if you want to familiarize yourself with the jQuery selectors:

http://api.jquery.com/category/selectors/
 
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ozzy
Top achievements
Rank 2
answered on 12 Nov 2013, 10:51 AM
Hi Kiril,

I had assumed that the filter functions using the normal jQuery selectors, however, in trying a selector as follows, it does not work:
filter: "tbody > tr > td:eq(1)"
Can you confirm whether a filter like this will actually work?  Is it possibly a bug?
0
Kiril Nikolov
Telerik team
answered on 12 Nov 2013, 04:45 PM
Hello Ozzy,

As this is a valid jQuery selector, it should be working as expected. Could you please extract a runnable sample, that is showing the incorrect behavior, so we can take a look?
 
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Drag and Drop
Asked by
Ozzy
Top achievements
Rank 2
Answers by
Ozzy
Top achievements
Rank 2
Kiril Nikolov
Telerik team
Share this question
or