dart-archive / polymer-dart

Polymer support for Dart
https://pub.dartlang.org/packages/polymer
BSD 3-Clause "New" or "Revised" License
181 stars 33 forks source link

Filter not working and no error #687

Closed terrywarwar closed 8 years ago

terrywarwar commented 8 years ago

I've got a filter set as below and it's not working. Is there anything else I need to do or import. <template is="dom-repeat" items="{{data}}" filter="filterItems" observe="feederCode">

@reflectable bool filterItems(item, [_, __])=> item.feederCode == "XT12";

dam0vm3nt commented 8 years ago

try casting the item to dart with convertToDart(item).

terrywarwar commented 8 years ago

just tried it, no difference. @reflectable bool filterItems(item,[_, __])=> convertToDart(item).feederCode == "XT12";

jakemac53 commented 8 years ago

The tests for this functionality are passing, so there must be something else going on. Can you post a more complete repro?

terrywarwar commented 8 years ago

will try and reproduce in a smaller app. btw, can I pass a property into the filter like filter="filterItems(item, text)" with text being @property String text?

jakemac53 commented 8 years ago

It looks like you can, but need to wrap it in {{}} if you do that, https://www.polymer-project.org/1.0/docs/devguide/templates.html#dynamic-sort-and-filter-changes

terrywarwar commented 8 years ago

thanks I'll try it out, what would be the equivalent function in dart, do we pass the item in@reflectable bool filterItems(item,text)

terrywarwar commented 8 years ago

Tried the same example with a closure @reflectable computeFilter(t) { return (Employee employee) => employee.last == t; }

`