开发者

Is there a table object with sorting functionality freely available for JavaScript?

I am in need of an abstraction for tables in a JavaScript application that is heavily table-based. I plan on making a JavaScript class with the following functions

  • Constructor to create the table from an array of objects
  • Constructor to create the table from an array of headers and an array of data
  • Methods for sorting by any of the columns
  • Methods for splitting the table into pages and traversing them
  • Methods for tying the object to a HTML element, drawing a HTML table representation inside it

The class will be small, light and contained in a single JavaScr开发者_高级运维ipt file. Also the class will be free to use for anybody.

But before I possibly reinvent the wheel, I have to ask:

Does something like this exist already? (I couldn't find anything)


The class will be small, light and contained in a single JavaScript file. Also the class will be free to use for anybody.

Once you have that restriction, I'm pretty sure that the tradeoff between using someone's API or implementing your own will lead you to 'reinvent the wheel', because the time to understand that API and adapt it to your current code maybe is not worth, compared to the effort to implement.

Anyway, if you still wants to use some API, i've found this post somewhere that maybe can help you. Good luck.


Why you want write one more sortable table class? There are some good one already.

Look at jqGrid for example. It is free open source. You can download it here, see different demos here. Additionally you can find the latest source code of jqGrid on GitHub.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜