Sep
13
Filed Under (Uncategorized) by Thejesh GN on 13-09-2007

Sortable Table is a great javascript library for client side sorting of HTML table. Its under Apache 2.0 license so its very compatible. Recently I faced a bug when sorting date columns. It was not sorting the dates properly. After some debugging I got to know that the library assumes the date format to be yyyy-mm-dd. See line 287 or search for case “date”.

var parts = sText.split("-");
var d = new Date(0);
d.setFullYear(parts[0]);
d.setDate(parts[2]);
d.setMonth(parts[1] - 1);
return d.valueOf();

Now to make it compatible with your date format say mm/dd/yyyy. You need to update it as

var parts = sText.split(" ");
parts[0] = sText;
var date1 = parts[0].split("/");
var d = new Date(0);
d.setFullYear(1970 + parseInt(date1[2]), date1[0], date1[1]);
d.setHours(0);
d.setMinutes(0);
return d.valueOf();

The new version is v1.12 and it still has this problem. The code in the new version is
SortableTable.toDate = function (s) {
var parts = s.split("-");
var d = new Date(0);
d.setFullYear(parts[0]);
d.setDate(parts[2]);
d.setMonth(parts[1] - 1);
return d.valueOf();
};

You need to update this snippet to reflect your date format. You can reuse the above code. I am thinking of rewriting date parsing part to parse the date in any given format. So the fix becomes much generic. Will update once I do that.



Sep
10
Filed Under (Uncategorized) by Thejesh GN on 10-09-2007

Last few days I was fighting with Modal Dialog ( opened with the method showModalDialog ) to forward to a new page with out opening a new window.The usual
document.location.href = newurl;
works but opens in a new window. Then I got a simple solution. window.name = "somename"
window.open(newurl, window.name)
well this works very fine. It opens the new url in a wondow with the name “somename”. Since that is our modal dialog is “somename” destination url opens in this modal dialog.



Jul
12
Filed Under (Uncategorized) by Thejesh GN on 12-07-2007
  • jsLogger - JavaScript logger for your web application Coded by yours truly.JsLogger is a Javascript logger utility. Just include it in your HTML file using script tag. And start logging. Has many features like disabling logging, Styling etc. Its just v1.0. Give your suggestion to improve it
  • XML to JSON - a converter There are probably tons of XML to JSON converters floating around out there by now, some written in JavaScript and some in different server side languages. Anyway I wrote this one, xml2json.js, about a year ago – it’s small (5 kB) and rather fas
  • Cross Platform XML Parsing in JavaScript XML for SCRIPT is a powerful, standards-compliant JavaScript XML parser that is designed to help web application designers implement cross platform applications that take advantage of client-side manipulation of XML data. XML for SCRIPT provides a full suite of tools


Jul
10
Filed Under (Uncategorized) by Thejesh GN on 10-07-2007
  • 80+ AJAX-Solutions For Professional Coding
  • In this article we’d like to present a list of over 90 useful AJAX-based techniques you should always have ready to hand developing AJAX-based web-applications. Auto-completion, instant field editing, menus, calendars, interactive elements, visual effects, animation, basic javascripts, as well as an extensive developer’s suite should give you a useful and powerful toolbox you can use every day, without a need to go through hundreds of AJAX-related bookmarks.

  • E-junkie Shopping Cart for selling downloads & tangible goods
  • E-junkie provides you shopping cart and buy now buttons to let you sell downloads and tangible goods on your website, eBay, MySpace, Google Base, Yahoo stores and other websites using PayPal, Google Checkout, Authorize.Net, 2CheckOut and ClickBank. …

I am on ma.gnolia. Its an awesome social bookmarking site. Add me as friend if you on ma.gnolia too.