Shaun Mccran

My digital playground

02
J
U
L
2010

How to reload a JQuery Datatables table data, using the API

Since I found the JQuery dataTables plugin, I use it quite a lot. I think it's a great way to display tabulated data, and it provides simple easy to use pagination and filtering options.

I've been building an interface to manage data, and arrived at the need to reload a datatable powered table, through a JavaScript request, rather than a page reload, or external variable (Url or form).

The problem with this is that if you try and re initialise a datatable into an existing datatable you get an error:

view plain print about
1DataTables warning: Unable to re-initialise DataTable. Please use the API to make any configuration changes required.

So you cannot re initialise an existing dataTable object. Looking through the API methods there is a relatively straight forward fix.

view plain print about
1if (typeof dTable == 'undefined') {
2
3    dTable = $('#example').dataTable( {
4    // data tables code
5    "bProcessing": true,
6    "bStateSave": true,
7    "bServerSide": true,
8etc...
9    aoData.push({ "name": "pageFilter", "value": filterText });
10    });
11else
12        {
13            dTable.fnDraw();
14        }

This code is basically checking if the object 'dTable' already exists, and if it is we are re drawing it, rather than using the existing object.

The fnDraw() method re-draws the table, so the data is refreshed. It uses the fnClearTable() method to first clear an existing data set, and the re draws it.

As an aside the 'filterText' value is a JavaScript value set elsewhere (a select field) that I am sending through to my server side request. It is used in a simple where clause in a query.

29
M
A
Y
2010

Xbox 360 Gamer Card App released on RIAforge.org

After Scotch on the Rocks in London I was struck with how many developers are also gamers. It seems there are a lot of us who build applications for people, then go home and relax in front of an Xbox 360 Console.

With that in mind I thought I would wrap up a service I have used in the past. A site, http://www.mygamercard.net/ provides a service where you can generate a graphic of your Xbox 360 account. They call this a Gamer Card, and it is available in a few different formats.

There is an example here

You can download the project here: http://gamercard.riaforge.org/

[ More ]

25
M
A
Y
2010

Scotch On the Rocks – day one review

Monday was the first day of the 'Scotch on the Rocks' 2010 Adobe conference (sponsored by Fuzzy Orange). I went along for a couple of reasons. To see what has been happening in the community, what development ideas people were throwing around as it is a bit of a two day think tank, and to put some faces to the Twitter accounts I've been following.

This article is a breakdown of the first days seminars I attended, and some thoughts and considerations about the content on show.

[ More ]

10
M
A
Y
2010

Incredibly simple JQuery image change on mouse over effect

I was recently asked in conversation if it would be possible to have a list of items, and when a user mouse'd over the headers in the list, an image effect happened, IE a thumbnail image was displayed. I figured this would be an ideal use for JQuery, so this article is how to write an incredibly simple JQuery image change.

There is a full demo of this here: JQuery mouse over demo

[ More ]

_UNKNOWNTRANSLATION_ /