Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Advantage of using dojo custom widgets over normal javascript function

I am new to Dojo.

My requirement is to form a dynamic table based on json obtained from server,for this kind of use case people are suggesting Dojo's user defined widgets,but i can do this with normal JavaScript function() and i can dynamically apply parsers.

But if i am going for Dojo then what is the advantage?

like image 697
Kalyan Avatar asked Jun 20 '26 19:06

Kalyan


1 Answers

Well, you can make it easier to re-use and you might even win time. For example: Dojo already has some table-widgets (DataGrid, EnhancedGrid and Sitepen made a custom grid-widget called dgrid).

You can also save time by using a JsonRest store in stead of writing your own AJAX requests to obtain the JSON from the server.

The big advantage of this is that these stores are based upon an API. You can easily switch out your store and choose another store (a Memory store for testing for example). You can also use other widgets with the same store, so if you're unhappy with a DataGrid, you can switch to another widget.

So data/information is seperate from the user interface, which makes the life of a developer much easier.

You can also extend other widgets if you're unhappy with how it behaves, that's all built in in Dojo. By following the Dojo API's you also make sure your widget behaves similar to other widgets, so that will make it easier to use your widget, since it's similar to how other widgets work.

Some interesting URL's:

  • http://dojotoolkit.org/reference-guide/1.9/dojo/store/JsonRest.html
  • http://dojofoundation.org/packages/dgrid/
  • http://dojotoolkit.org/reference-guide/1.9/dojox/grid/DataGrid.html
  • http://dojotoolkit.org/reference-guide/1.9/dojox/grid/EnhancedGrid.html
like image 191
g00glen00b Avatar answered Jun 22 '26 08:06

g00glen00b



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!