I spent five minutes finding this today (don’t get me started on Dojo documentation!) so I thought I’d try and put it in an easier to find place – Google.
I wanted to specify my sort order declaratively as part of the tag defining my Datagrid and this is what I found to work :
This will tell the datagrid to automatically sort the Datagrid in a descending manner on column 4. If I’d used 5, or “+5″ then that would be in ascending sort order on the fifth column.
During June & July I will be travelling around WA & NT participating in a series of web workshops as part of the Federal Government’s Small Business Online program. A summary of the workshop is below.
In just 1 day ($49), you’ll learn the 8 fundamental building blocks of a successful online marketing and website strategy and have a complete action plan to help you put that knowledge to use.
The 7 small business owners and specialists in their field will show you how to use the Internet to promote your business and create a website that works to deliver real dollars to your bottom line.
From business planning through to optimising your site for search engines and simple online marketing tools, everything you need to know about developing a better online business will be delivered to you in an interactive workshop and 1-to-1 mentoring sessions where we will help you solve your business’ specific problems.
At the end of the 1 day workshop, you’ll understand the 8 building blocks of a well balanced, effective online marketing plan:
business plan, target market & purpose
website design
content building & copywriting
graphic design & layout
website imagery & photos
website traffic generating tools such as pay per click advertising (PPC) & search engine optimisation (SEO)
website promotion & relationship building tools such as Twitter, Facebook & other social media
and the often underutilised and powerful email marketing tools you have at your disposal
You can find more information about the workshops and how to register here: Achieve More Online
Today I was fiddling with some code to get particular types of payments that are due on particular days and I ran across a couple of things I don’t want to solve again.
Firstly, the problem of being able to have default arguments to a block in ruby. It’s solved nicely in Ruby 1.9 but we’re using 1.8.x on our boxes at the moment. The work around is incredibly simple though and goes something like this :
That’s all there is to it really. You could go the whole hog with hashed attributes and so on but I think it starts to get a bit smelly if your anonymous functions are taking more than one argument.
The other issue I had was whether a named scope can include a join, and it can.
The coolest thing about all of this though (and I feel I’m very late to the party here) is that I now get to do things like :
Payment.credit_card.due_on(Date.today)
# or
Payment.credit_card.due_on
# or
Payment.due_on(Date.today + 1.month)
In the above I had just used the default argument to the due_on named scope to be today’s date.
I mean, I’d seen a bunch of tutorials on named scopes and how they worked but hadn’t found a use case in my work. I think it’s finally twigged for me though and will be making use of them a bit more in the future.