简体   繁体   English

使用Derby.js进行客户端模型过滤

[英]Client-side model filtering with Derby.js

I am creating a webpage that will display some models as a table and allow the user to filter the items of that model by tags. 我正在创建一个网页,该网页将一些模型显示为表格,并允许用户按标签过滤该模型的项目。

I am new to Derby.js and currently have it working to the point where I am able to send the data from the server to the client with model.set('items', items); 我是Derby.js的新手,目前可以使用model.set('items', items);将数据从服务器发送到客户端model.set('items', items);

and in the view 并认为

{#each :items}
    {.title} - {.description}
{/}

All the items also have a tags property. 所有项目还具有tags属性。 I'd like give the user a list of these tags and allow hi to filter the displayed items by clicking on the tags he's interested in. How do I go about this? 我想给用户这些标签的列表,并允许hi通过单击他感兴趣的标签来过滤显示的项目。我该如何处理?

As I understand it, I probably have to do my templating client-side instead of the current way - if so, how do I access the model object in client-side JS in Derby.js 据我了解,我可能必须对客户端进行模板化,而不是当前的方式-如果是这样,如何在Derby.js中的客户端JS中访问模型对象

Alternatively, is there a way to dynamically specify the filters to the model in Derby.js? 或者,是否有办法为Derby.js中的模型动态指定过滤器?

model.filter('items').ref('_page.items');

{#each _page.items}
  {.title} - {.description}
{/}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM