Hi Jeroen,

Jeroen, I know you are busy with the Education extension and in
response to my earlier email I took the liberty to create a simple SRF
extension[0] that uses the jQuery DataTables plug-in.

The extension is quite simple as it uses more or less the same code as
in SMW_QP_Table.php with an addition of calling the DataTables
javascript that handles the display of the table.

==Current features ==

The current implementation allows:
# Table pagination
# Table in-line search
# Alternating row colours
# Sorting
# Adding table class through SRF class parameter

The implementation does not use any inline JS, all JS code is
outsourced in a file (srf.datatables.js) which is loaded through the
ResourceLoader.

== Ajax ==

Current implemented features are standard and do not warrant for an
additional SRF module but aside those design features, DataTables does
allow to reload data from a AJAX source[1] which would be a major
advantage for lists containing a large amount of data elements as
their could be progressively sourced after the page is loaded.

To make this work it would probably needs a working SMW API and as my
knowledge on ajax is zero, I do hope other experts in this community
could have look at it and make it work.

It might be that at a later point instead of transferring the data as
html object, a JSON object needs to be used so DataTables itself can
handle the display while the reload via Ajax would follow the same
entry point via the JSON object.

==Column filtering ==

Another feature (not enabled) is the possibility to individually
filter columns[2] by using input fields connected to each column.

If those two features are implemented, we would come a step closer in
making the list display of data more responsive and intuitive without
increasing the page loading time.

==Styling ==
The table styling can be influenced by either custom classes or jQuery
UI ThemeRoller, right now the deployed css class is rather simple (but
is serves the purpose).

== Current hiccups and something to fix ==

In general, MediaWiki tables do not work with <thead>, <tfoot> but
those are vital for DataTables to work with. So what I had to do, use
a small hack before the actual DataTables js comes into to play to
convert the first line into a <thead></thead> pair. This part of the
JS certainly needs some brush up, so someone feel free to make it
better.

When a wiki page does load more than one datatable (it works ok
without SRF), something isn't quite right with the positioning of the
headers (certainly has something to do with the hack that is currently
used to convert the <thead>). So it would be nice If some one could
fix this.

Since Jeroen is busy, it would be nice if  someone else could have a
look at it before it is deployed.

Right now it is hosted on [0] but I can create a bugzilla report and
attach the patch files (some SRF files needs to be patched as well).

[0] https://github.com/mwjames/smw-srfdatatables

[1] 
http://datatables.net/release-datatables/examples/server_side/server_side.html

[2] http://datatables.net/release-datatables/examples/api/multi_filter.html

Cheers,

mwjames

On Sun, Jan 22, 2012 at 1:52 PM, Jeroen De Dauw <jeroended...@gmail.com> wrote:
> Hey,
>
>> However you would be loading the entire results in one shot, which could
> increase page load times with large data tables.
>
> Definitely not. You can not even do this due to query result limitations
> unless you go run multiple queries, but that's very evil.
>
> It'd just load the results you display initially, and then load more if
> they are needed. Think of Twitter and Facebook; they both load more tweets
> or nonsense of your friends if you click some continuation button or scroll
> down the page.
>
> Cheers
>
> --
> Jeroen De Dauw
> http://www.bn2vs.com
> Don't panic. Don't be evil.
> --
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Semediawiki-user mailing list
> semediawiki-u...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to