Build awesome re-ordering interface in PHP/ATK4 with one line of code.

Wednesday, October 5th, 2011|Uncategorized|by Romans

Agile Toolkit is awesome because it’s simple. Sometimes it lacks a feature, but it’s simple to add this feature. Having all those features in the core would be an over-kill, so many features are not in there on purpose.

An example is this controller, which will make items in your Grid order-able. Here is the screenshot of how it performs:

This sexy interface is implemented as a stand-alone controller in Agile Toolkit in about 70 lines of code and small bit of HTML,  no JS or CSS. But more importantly, it can be added to any Grid out there with just this:

[php]
$grid->add(‘Controller_GridOrder’);
[/php]

Why is it important / cool?

  • It uses standard interface and will look right at home inside your project.
  • Relies on standard elements of Agile Toolkit.
  • Simple enough for you to read through and understand
  • Object-oriented so you can extend it to make it behave differently.
  • Requires no change to Grid.
  • Works with any model (just add numeric field “ord”)

Share your code!

When you develop your software, your goal is to get it done. This controller  took me about 30 minutes to implement. To properly document it and share, it would take some more time.

I’m pretty sure it’s same for you. If you are developing with Agile Toolkit, you might have a few interesting bits out there. My plan is to make it super-easy for you to throw a link to your Github repository and then let others convert your code into the properly documented add-on. Instead of re-inventing it, they could clean it up and document.

This way we don’t have to re-implement every bit and we’ll have a great library of add-ons growing!

How to share.

First – put your code into github and make it public. Even if it’s your personal project, it won’t hurt.

I’ll be working on the section on www.agiletoolkit.org where you will be able to “share” some goodies you have in your code. Leave it to other devs to extract it from your code, clean it up and improve. Your contribution to Agile Toolkit community would be highly appreciated.

2 Comments

The Elter
Posted October 6, 20118:07 am

Wonderful!
I started a new project with atk, is a little hard to understand the documentation (is too sparse at the moment) but the results are really cool…

Romans
Posted October 7, 20111:51 am

Elter, great. Keep questions coming. Also do let me know where I can improve doc.