The Arcive of vBulletin Modifications Site. |
|
|
#1
|
||||
|
||||
|
Hi, I tried to set up a sorted DataTable using YUI 3, on YUI 2 there was a way using formatter:YAHOO.widget.DataTable.formatNumber to get numbers sorted right.
But on YUI 3 this doesn?t work or I don?t know how to implement it. For example, this pre-sorted data: Code: Code:
YUI().use("datatable-sort", function(Y) {
var cols = [
{key:"Company", label:"Click to Sort Column A", sortable:true},
{key:"Number", label:"Not Sortable Column B", sortable:true},
{key:"Contact", label:"Click to Sort Column C", sortable:true}
],
presortedData = [
{Company:"Acme Company", Number:"8", Contact:"John Jones"},
{Company:"Company Bee", Number:"100", Contact:"Sally Spencer"},
{Company:"ABC Company", Number:"124", Contact:"John Miles"},
{Company:"Company BCF", Number:"80", Contact:"Sally Spader"},
{Company:"Company Blue", Number:"94", Contact:"Robin Smith"}
],
table = new Y.DataTable.Base({
columnset: cols,
recordset: presortedData,
summary: "Contacts list",
caption: "This table loads with presorted data"
}).plug(Y.Plugin.DataTableSort, {
lastSortedBy: {
field: "Company",
dir: "asc"
}
})
.render("#presorted");
});
8 80 94 100 124 I?m not familiar with java code, so please keep it simple. Any help would be great, thank you. |
|
#2
|
||||
|
||||
|
Why not use jquery?
http://www.jquery4u.com/plugins/30-a...jquery-tables/ |
|
#3
|
|||
|
|||
|
Quote:
You just need to take the quotes out from around the numbers (in the presortedData array initialization), so they'll be numbers instead of strings. (BTW I'm not a YUI 3 expert, I was just looking at an example when I happened to notice that their numbers weren't inside quotes.) |
|
#4
|
||||
|
||||
|
Quote:
Quote:
Thanks a lot.
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|