univ().ajaxify() method

Wednesday, April 21st, 2010|Beginner tips, Version 3|by Romans

The other day I have added this method for skai, but it’s actually a very curious one.

Agile Toolkit 4 uses atk4_loader widget for AJAX requests. Syntax is very similar to jQuery:

  • jQuery: $(‘#div’).load(‘url’);
  • atk4:  $(‘#div’).atk4_load(‘url’);

Agile Toolkit 4 method is very different in it’s approach. It initialises a widget around the #div which then is used to load the contents. It enhances handling of AJAX response such as handling of expired sessions, broken pages, errors. It improves script execution which are passed through the ajax response. It will integrate with atk4_form and if there is a form inside widget, it will make sure it’s contents are saved, and will display warning otherwise.

When you open a new dialog with $.univ().dialogURL(title,url); it will automatically initialise atk4_loader. Which means – inside new page you can use things like:

  • $(‘..’).closest(‘.atk4_loader’).atk4_loader(‘reload’) – will refresh contents of the frame
  • $(‘..’).closest(‘.atk4_loader’).atk4_loader(‘loadURL’,$url) – will load other URL in frame.

Finally – there is a method you can use which is called ajaxify. This will make sure regular links open inside atk4_loader and not change url location. Let’s say you are adding a grid with “link” rows. Those rows normally will take you to other page. However if you want them  to open inside frame, you should do this;


Implementation is very simple , you can take a look inside atk4_univ.js.