Sunday 20 September 2015

What is the difference bettween ListView, FormView, and PageView? in JScript for (ODOO | OpenERP)

Forms
Form views are used to display the data from a single record. Their root element is <form>. They are composed of regular HTML with additional structural and semantic components.
  • Deal with single record at a time.
  • Can contains other structural components (like notebook, sheet).
  • There is no scope to sorting & searching because at the moment there is only single record.
Lists
The root element of list views is <tree>. The list view's root can have the following attributes:
  • Display record set in tree.
  • Can not contain any structural components.
  • Searching and sorting is possible.
There are javascript files are for each view in odoo, you can refer it from WEB module.
  • Web/static/src/js/view_form.js
  • Web/static/src/js/view_list.js
  • Web/static/src/js/view_list_editable.js
  • Web/static/src/js/view_tree.js
And other supportive functions sidebarxml_to_jsonxml_to_strjson_node_to_xml,fields_view_get and many others are available inside the views.js.
Page is structural component so it's covered inside the formview.
Javascript module structure for WEB.
JavaScript module mainly construct based on these three concepts.
  1. Classes
  2. Widgets
  3. The QWeb Template Engine
Classes :
Much as modules, and contrary to most object-oriented languages, javascript does not build in classes although it provides roughly equivalent (if lower-level and more verbose) mechanisms. For simplicity and developer-friendliness Odoo web provides a class system based on Javascript Inheritance.
Widgets :
The Odoo web client bundles jQuery for easy DOM manipulation. It is useful and provides a better API than standard W3C DOM2, but insufficient to structure complex applications leading to difficult maintenance.
Much like object-oriented desktop UI toolkits (e.g. Qt, Cocoa or GTK), Odoo Web makes specific components responsible for sections of a page. In Odoo web, the base for such components is theWidget() class, a component specialized in handling a page section and displaying information for the user.
The QWeb Template Engine :
This allows generating and displaying any type of content, but gets unwieldy when generating significant amounts of DOM (lots of duplication, quoting issues, ...)
As many other environments, Odoo's solution is to use a template engine. Odoo's template engine is called QWeb.
QWeb is an XML-based templating language:
  • It's implemented fully in JavaScript and rendered in the browser
  • Each template file (XML files) contains multiple templates
  • It has special support in Odoo Web's Widget(), though it can be used outside of Odoo's web client (and it's possible to use Widget() without relying on QWeb)

No comments:

Post a Comment