Category Archives: Javascript / HTML / CSS

Deferreds in loops and recursive functions (Dojo)

When working with deferreds it sometimes is not that easy and intuitive as I thought. If you don’t know perfectly well how the deferreds work, then a little mistake can destroy all the fun you can have with deferreds … and bring you headaches.

Most of the times you probably will use deferreds that are easy to handle, like in the following example:

So in this case you simply create a new deferred object and return its promise to the caller. When the remote call or whatever delays your execution, is finished, the deferred gets resolved and the caller can continue.

Read more... (241 words, estimated 58 secs reading time)

Posted in Javascript / HTML / CSS | Tagged , , | 1 Comment

Add DoubleClick behaviour to ng-grid

If you want to react when double-clicking on a row of a ng-grid in AngularJS, then you can do the following:

  1. Add the following Javascript-File to some dir accessible from your app and don’t forget to load it during startup.

  2. Define a function to handle the double-click and update the grid-options as shown here:

And now have fun :)

 

 

Posted in AngularJS, Javascript / HTML / CSS | Tagged , | 10 Comments

IE: Event in onClick-Handler

When I normally register an onClick handler in Firefox or Chrome, the first argument will contain the event itself, but what about our old friend IE? This one won’t get any arguments and I wondered how I could access the event to figure out what kind of event it exactly was … and which target had been hit.

In IE there’s a global variable called ‘event’ which can be accessed and contains all the data we want to have. So in your code you probably need something like:

to make it work in all browsers!

Posted in Javascript / HTML / CSS | Leave a comment

Add customized Like-Button to your website

I was trying to put one of those Facebook-Like Buttons onto one of my websites. Of course I didn’t want to use their style(s), but a different one that would fit into the design of my site. On the other hand the original design every one knows and also knows the meaning immediately. However, if you wanna change the style of your Like-Button than it won’t be easy!

The usual way to get your Like-Button onto your site is to go to the Facebook website and get fetch some code that you simply put onto your page. Afterwards you have a fully functional Like-Button with lots of features. You can even write a comment, once you clicked the button and are logged in to Facebook.

Read more... (556 words, estimated 2:13 mins reading time)

Posted in Javascript / HTML / CSS | 1 Comment