In HTML5, any attribute beginning with data- will be considered valid HTML and be ignored by the browser. Therefore, custom attributes can be placed on elements to store data that cannot be defined with the standard ones.
Dash employs these attributes to let you define JQuery UI elements in HTML so that you don't have to initialize them in JavaScript. For example:
<input type="text" data-datepicker="true" />
will get you a JQuery datepicker with default settings.
Let's say your client comes back to you and requests that this input field be a datetimepicker instead. Then, all you need to do is make a small change to your HTML:
<input type="text" data-datetimepicker="true" />
This promotes rapid, flexible development in the face of changing requirements. Of course, this is a trivial example, but it illustrates the basic benefits of the Dash library.


No comments:
Post a Comment