Archive for the ‘Javascript’ category

ContentPane in dojo not loading scripts? This is how you fix it.

December 16th, 2010

I was planning on writing my first enquiry on how to do something in dojo, but just before I pressed the submit button, I thought I’d look into one more thing and as the saying goes – “it’s always in the last place you look” (probably because you stop looking after you find whatever it is you’re looking for).

So the problem I had was that I wanted to load a datagrid inside a contentPane in a pet project my newbie friends and I are using to sharpen our Zend Framework skillz.

I’ve been idle (and will continue to be for the rest of the year) so all my tickets are pretty much at a stand still. This included a ticket which reports that a remote datagrid does not load properly in chromium / google chrome, but loads fine in Firefox. But seeing as I have a few hours to kill from being idle (development wise, but actively looking after family) , I thought I’d do an idle search into why this was happening. Dojo could not possibly have a bug, there must be some magic attribute that needed to be set which would make it all better.

So I started my search. Looking for things like “ContentPane not loading datagrid in tabContainer dojo” through to “javascript events not firing in contentPane dojo dijit” for those of you who look for answers to advanced questions when it comes to the dojo toolkit, you know how teeth-gnashingly frustratting it is to look for answers.

A couple of them mentioned “executeScript” attribute, but that was from ages ago, so I tried it a couple of times to no avail in dojo 1.5 then gave up looking for answers that use executeScript attribute.

» Read more: ContentPane in dojo not loading scripts? This is how you fix it.

Two Dojo JavaScript Gotchas that got me

November 19th, 2010

I was just about ready to tear my own head off when I’ve finished unit testing my Service and Model classes and had damn near close to 100% code coverage, and ran into some really fiddly issues with dojo. I’m doing this retrospectively, so off the top of my head these are the two issues that had me scratching my head due to their obscurity.

First issue: got a ”dojo.data.ItemFileWriteStore” is not a constructor” message.

I use ItemFileWriteStore as my data store for a combo box intended to list fields in a search. Users could then have the ability to filter through the list by typing a letter in the combobox and auto complete suggestions will be displayed in a list below ala a select list. Problem is when I was running it, I get this error message.

I decided to verify that nothing’s wrong with the way I built the dojo JS library. Then headed to google. First few results were garbage, then came an exact match. It was one of two cases:

  1. dojo.require() is missing
  2. The constructor statement occurs before dojo has completed loading.

» Read more: Two Dojo JavaScript Gotchas that got me

Remembering Field/Column widths in DojoX Datagrid Component

July 11th, 2009

We had to do implement a workaround for a limitation in the Dojox DataGrid component that does not have an easy way of remembering datagrid column widths adjusted by the user.

This took some time to actually get my head around, but I have managed to “will” this solution into existance. I say “will” because i’m not too happy with the implementation. It’s a workaround that works for the mean time anyway.

I’ve written the description here on the “DevProducts on Blogger” blog – Check out the post for more info: Persistent Column Widths in Dojo (dojox) DataGrids

Good Online JavaScript Encoding & CSS Compression tools

November 26th, 2007

As I was looking at shrinking the CSS and JavaScript files DevScripts from 60+kb and 70+kb respectively, I found a couple of helpful of good tools to keep handy when you’re dropping your projects into production.

To compress javascript I used the Code and Coffee online JavaScript compression/encoding tool, and for cleaning up the CSS, I used CleanCSS which was sent to me by a former colleague.
» Read more: Good Online JavaScript Encoding & CSS Compression tools