Dojo patch rejected :(

I’m using the dojo dropdowndatepicker in a lot of my projects. Problem with this widget is that it only really supports the yyyy-mm-dd notation (as the standard is). But all the applications I develop the people want our local notation (dd-mm-yyyy). So I wrote a small fix that helps. Too bad it got rejected as it doesn’t fit in the idea of the project and the new widget set they are building.

For now it’ll be a patch I have to apply on all my dojo downloads to get the functionality I need from it. And let’s hope in the future we will migrate our code to the iso standards, right?

DWR

In one of my projects the user has to select a customer from a dropdown list. Problem is that the number of customers they have is much to big to prefill. So I used dwr to build a solution. The user has a dropdown from which he can choose the field he wants to query (let’s say street), he than fills in a streetname, presses the button and the list gets prefilled with the list of customers who match.

How does it work. Wel really simple 🙂

In my backend I have a simple POJO Search with a method getCustomers(String searchField,String searchValue). This calls a service layer, who in turn calls a dao layer,… you know the drill. In the end the method will return a List of Customer objects. I exposed these objects in the dwr.xml configuration file. (that’s it for the java backend stuff) (nice isn’t it 🙂 )

Now the javascript part is also small and handy. I had to include the dwr engine and my exposed object as javascript objects. When the user presses the button this small piece of code gets executed


Search.getCustomers(searchField,searchValue,CustomerCallBackHandler);

When the javascript gets a response back, the CustomerCallBackHandler will be executed. That looks like this


function CustomerCallBackHandler(data){

Where data is an array of Customer JSON objects. This means that in my java Customer object I have the getter/setter getId(),getName(). In javascript I can simply do data[0].id and data[0].name.

Now isn’t that nifty?! 😛

/me like