Knockoutjs:扩展SimpleGrid以支持排序 [英] Knockoutjs: Expanding the SimpleGrid to Support Sorting

查看:68
本文介绍了Knockoutjs:扩展SimpleGrid以支持排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您将如何修改 knockout.js simpleGrid插件以支持列排序?

How would you modify the knockout.js simpleGrid plug-in to support column sorting?

我有以下代码: http://jsfiddle.net/NaveenVelaga/QSRBR/9/

推荐答案

我对提供的代码不满意.

I have had a fiddle with the supplied code.

我修改了simpleGrid代码,以期望在列数据中使用排序功能. 这样,我们就可以通过提供的功能连接模板以对点击进行排序.

I have modified the simpleGrid code to expect a sorting function in the column data. This way we can wire up the template to sort on click via the supplied function.

http://jsfiddle.net/QSRBR/39/

这是一个简单的解决方案,需要扩展以包括双向排序逻辑 (第二次点击的方向相反)

This is a simple solution which needs to be expanded to include bi directional sorting logic (second click sorts in reverse direction)

这篇关于Knockoutjs:扩展SimpleGrid以支持排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆