Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Does kendo-list-view actually work? #83

Closed
SimeonRoss opened this issue Sep 3, 2013 · 7 comments
Closed

Does kendo-list-view actually work? #83

SimeonRoss opened this issue Sep 3, 2013 · 7 comments

Comments

@SimeonRoss
Copy link

Hi,

I'm trying to do a kendo listview control. The directive kendo-list-view seems to work on a div. However I'm at a loss for how to specify the template?

The best I have managed is: <div kendo-list-view k-data-source="people" k-template="'<div>#=name# #=age#</div>'">
</div>

However that's not real awesome. What was the plan for working with this? Is there anyway to specify a script template block?

@SimeonRoss
Copy link
Author

I have managed to write a directive as shown below but again this feels very nasty

.directive('kendolist', function() {
return {
restrict: 'E',
replace: true,
scope:{source:'=source', temp: '=temp'},
template: '

',
link: function(scope,element,attrs)
{
element.kendoListView({
dataSource: scope.source,
template: kendo.template($(scope.temp).html())
});
}
}
});

    <script type="text/x-kendo-tmpl" id="template">
        <div class="customers">
            <dl>
                <dt>First Name</dt>
                <dd>#=name#</span></dd>
             </dl>
        </div>
    </script>

@ghost
Copy link

ghost commented Sep 3, 2013

it's totally doable to specify template in controller, just
in controller:
$scope.filesOptions = {
dataSource: Files.getFilesDatasource(),
template: kendo.template('#:uri# ')
}
in template:


    div kendo-list-view k-options='filesOptions' id="filesListView">

@SimeonRoss
Copy link
Author

Can you specify in the partial?

div k-template='' ?

@ghost
Copy link

ghost commented Sep 3, 2013

You said at the first post that you have managed to specify in k-template. But I think you like to supply the script block other than one line simple template. So I will choose to supply the template in controller since I can use Angularjs's $templateCache service to get a template for use.

@SimeonRoss
Copy link
Author

Sorry, I should be more clear, what I mean is can you do something like this:

<div k-data-source="someData" k-template="kendo.template('#:template# ')"></div>

<script type="text/x-kendo-tmpl" id="template">
<div class="customers">
<dl>
<dt>First Name</dt>
<dd>#=name#</span></dd>
</dl>
</div>
</script>

@ghost
Copy link

ghost commented Sep 4, 2013

Angular doc says what you can put in k-template="..." is Angular Expression. It's "like" JS expression but not the same thing. So you cannot do k-template="kendo.template('#:template# ')"
Hope this helps. Maybe you should checkout angular's doc about it's expression

@SimeonRoss
Copy link
Author

Aye, I will. Thank you muchly for your help

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant