# HG changeset patch # User Mads Kiilerich # Date 2014-07-03 01:03:27 # Node ID 5046b724a14000e079cc0c6310627915f8e7e169 # Parent a1b80a0a3e15324ddde51bac15867c8551bfedc6 rhodecode.js: implement YUI_datatable(data, fields, columns, countnode, sortkey) with body from repos.html Use datatable_list_wrap for the DataTable and _TM['MSG_X'] for localized strings. diff --git a/rhodecode/public/js/rhodecode.js b/rhodecode/public/js/rhodecode.js --- a/rhodecode/public/js/rhodecode.js +++ b/rhodecode/public/js/rhodecode.js @@ -2080,6 +2080,78 @@ var YUI_paginator = function(links_per_p return pagi } +var YUI_datatable = function(data, fields, columns, countnode, sortkey){ + var myDataSource = new YAHOO.util.DataSource(data); + myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; + myDataSource.responseSchema = { + resultsList: "records", + fields: fields, + }; + myDataSource.doBeforeCallback = function(req, raw, res, cb) { + // This is the filter function + var data = res.results || [], + filtered = [], + i, l; + + if (req) { + req = req.toLowerCase(); + for (i = 0; i