Dominic Myers writes about all sorts of stuff to do with HTML, CSS, JavaScript and a fair chunk of self-indulgent stuff. Thoughts and opinions are all his own, and nothing to do with any employer.
Wednesday, 11 September 2013
Saturday, 7 September 2013
Wednesday, 28 August 2013
Monday, 12 August 2013
DataTables (custom) sort by month name only
I use DataTables a lot, I think they're brilliant and I'm slowly getting to understand their intricacies. Anyway, I had a need to sort a column by month name only so I came up with this:
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; jQuery.fn.dataTableExt.oSort['month-name-asc'] = function (x, y) { var xPos, yPos; jQuery.each(monthNames, function (k, v) { if (x == v) xPos = k; if (y == v) yPos = k }); return ((xPos < yPos) ? -1 : ((xPos > yPos) ? 1 : 0)); }; jQuery.fn.dataTableExt.oSort['month-name-desc'] = function (x, y) { var xPos, yPos; jQuery.each(monthNames, function (k, v) { if (x == v) xPos = k if (y == v) yPos = k }); return ((xPos > yPos) ? -1 : ((xPos < yPos) ? 1 : 0)); };
Simply add "sType": "month-name" to the column def and away you go!
Monday, 22 July 2013
Instant Meteor JavaScript Framework Starter "Grapher is not defined"
The image above is the view from the front of the boat taken on the 13th of July 2013. It's pretty is all so I thought I'd put it here. It's got nothing to do with the excellent book in the title of this post!
The excellent book does, however, have one small issue in that I couldn't get the application to work... I did all sorts of searches (using variations of the terms in the post title - which I found using FireBug) to no avail. Then I realised this was a Packt book and I really should check the books page on there, taht was when I found Errata link and the helpful:
Errata type: Code | Page number: 34 | Errata date: 28 May 2013
Only for versions 0.58 and higher
The first paragraph of page 34, where it states that the reader should add the line should read:
Grapher = {};
instead of:
var Grapher = {};
I hope that this helps someone as it was doing my poor little noggin in for about a week (Should remember to check the source!)!
Monday, 15 July 2013
Sunday 14/07/2013 cycle-ride
Jolly good cycle ride yesterday - though I couldn't move my legs when I go back! It was all I could manage to stand up after my pint of San Miguel (not sure why it's my tipple of choice when the sun's out...) at The Green Dragon when we got back. Still, the cat was happy to see us back... by my reckoning it was something like 29 miles all together. Cycling along the guided bus route was a pleasure though!
Monday, 8 July 2013
Pub Quiz (02/07/2013)
Last Tuesday's pub quiz had the wrong answer. It asked about this historic tightrope walk and said the answer was The Grand Canyon, but it wasn't was it? Ohh no, it was the Gorge of the Little Colorado wasn't it?
Seems as though the quiz setter wasn't the only one wrong though as MSN got it wrong as well.
Thank you Mr Graham Haigh for getting the right answer! And He should know as he's been there! ;-)



