Feb13
One of the reasons quite a number of programmers don’t like Javascript because it’s weird, behaving differently on different browsers.. and hard to debug.. However, it’s quite fun or even addictive to learn JS also for that reason. Below is a brief on two mysterious properties of Javascript functions : length, and arguments.
continue reading »
Dec28
This is the first episode in the collection of Great Javascript articles by world’s top-notched Javascript gurus.
Our entry this week was written by Eric Miraglia originally posted on Y!UI Blog.
Global variables are evil. Within YUI, we use only two globals: YAHOO and YAHOO_config. Everthing in YUI makes use of members within the YAHOO object hierarchy or variables that are scoped to such a member. We advise that you exercise similar discipline in your own applications, too.
Douglas Crockford has been teaching a useful singleton pattern for achieving this discipline, and I thought his pattern might be of interest to those of you building on top of YUI. Douglas calls this the “module pattern.” Here’s how it works:
continue reading »
Dec23
Following another question on ExtJS forum, I’ve created a sample of how to use vType for ExtJS newbies.
Basically, in form submission you need to validate user input and / or prevent user from entering invalid keys. Pure Javascript implementation could be quite a headache to some folks. ExtJS now provides a regex-based validation class called, vType, which helps you to do both things mentioned above.
Demo: a simple Custom vType
continue reading »
Dec19
Today at work, I happened to write a function that removes white spaces from a string. After trying different ways using: loops, array indexer, or regex, I came up with the shortest way using regular expression to share with you:
continue reading »
Dec19
This blog entry was written following a question of an user in ExtJS forum: How to drag n’ drop a button on a panel ?
ExtJs people tend to just focus on the grid-to-grid, grid-to-listview.. sort of drag and drop, and forgot to include in their documentation a typical example of ‘drag and drop’ of a simple element like a button on a panel. Below is my implementation:
ExtJS: 3.x
Demo: Drag and Drop a button
continue reading »