Its about being a prototype, Mochikit and the like minded.

Its about being a prototype, Mochikit and the like minded.

Jun 23

I love prototypes, here is what I have been doing.

  • Prototyping for Web Applications
  • Using Prototypes for Javascript
  • Configuring Prototypes for Actionscript

That was a feign attempt at making this search engine friendly, Now that it failed, Read on to the real stuff ;)

Mochikit uses simple attributes, to create an unobtrusive _Javascript based interface. I used the sortable tables demo. There were two issues, only ISO standard strings were allowed on the date sorting and no blank strings please we are puritans :)

The issues

There were primarily two issues

  • My date input was non-standard, short month name – mm -yyyy ( Jan-05-2006) .
  • The date sorting crashed, if the date string was blank

Issue 1: Non-standard dates

The solution

If you have no idea what’s going on, I strongly suggest looking through the sortable tables demo and setting it up on your local box .

Line 98 of sortable_tables.js

Dobj=obj.split('-');
myobj=Date.parse(Dobj);
theobj=new Date(myobj);
obj=theobj;
break;
The solution basically parses the date object by splitting it into an arrray and create a new date object for the consumption of the script. The solution basically parses the date object by splitting it into an arrray and create a new date object for the consumption of the script

Issue 2 : Blank Date-strings, crashing the sort.

If a blank string was entered, the sorting tend to crash for the “isodate” sorting.

The solution

Line 96 of sortable_tables.js

case 'isoDate': //In case date's are null, move them to the end
if(obj=="") obj="Jan-05-2200" ;

This takes care of the code, if the date string was empty, moving it to a future which is not displayed on the table but passed to the string.

Leave a Reply