How to build a Manual Window in Openbravo 3
Here you have the recorded session on “How to build a View Implementation” in two parts.
I. The basics
II. Adding a button and an Action Handler
Timeline
- 35m28s: I said “punto” that means “dot” in Spanish. A few seconds later I say “chuleta” that means “cheat sheet” in Spain.
- 45m55s: I started talking on “Don’t be fooled by console.log“
- 52m02s: The importance of using
OB.Constants.FIELDSEPARATOR
andOB.Constants.IDENTIFIER
- 57m15s: An idea on how to support a dynamic generation of a Selector in a view implementation
You can get the code of this example at: https://bitbucket.org/iperdomo/org.openbravo.training.manualwindow
Hi Ivan,
Great work,,very useful for all Openbravo developers.
Thirumalai.
Thirumalai
May 23, 2012 at 7:59 am
Hi Katratxo,
just watched your two screencasts about building a manual window. Thank you for your effort!
But when trying to comprehend and reproduce these steps in my local Openbravo workspace (Eclipse), I’m facing following problem:
When opening my new view in OB an error “Error occured: No class and no template defined for view” rises up.
When selected “OB Standard View” as Template, I’m getting the following error in JavaScript Console when open the create View (as reference – that’s 39:34 in your video):
Uncaught SyntaxError: Unexpected token ,
In ISC_Combined.js:312
So I re-watched your cast again and figured out that you used module “Training View Implementation” (37:24 in video), but when creating the menu entry, you use module “Sample Manual Window” (38:25 in video). Why? Accidentally?
I would kindly ask you for a hint how to get that solved.
Thank you in advance,
Victor
Victor Roeder
June 25, 2012 at 5:01 pm
Hi Victor,
When you define a “View Implementation”, the name of the View Implementation *must* match the JavaScript “class name”, e.g. DBPrefix_MyClass
If you are building a View Implemetation without code generation there is no need to choose any Template.
You can clone the code from https://bitbucket.org/iperdomo/org.openbravo.training.manualwindow in your modules folder and run: ant smartbuild -Dlocal=no
More info at:
http://wiki.openbravo.com/wiki/How_to_implement_a_new_main_view
For further help, I suggest you use the Developer forum:
http://forge.openbravo.com/projects/openbravoerp/forum/developers-f549512.html
Cheers,
katratxo
June 25, 2012 at 6:23 pm
Hi,
thanks for your fast reply – I got it working! 🙂
Problem was, that I defined the class in the main.js as ‘xxxxx_YyyyYyyy’, instead of ‘XXXXX_YyyyYyyy’. So the DB prefix was in lower-case instead of upper-case.
Thanks again for your mail and have a nice evening,
Victor
Victor Roeder
June 25, 2012 at 9:37 pm
Hi Katratxo, thank you for your video, it’s very helpful. I’m having a technical issue with my Eclipse, every time I’m dealing with Javascript in Openbravo, Eclipse froze up and I must wait several minutes before it came back to “life”. Any thoughts?
Alberson Melo
January 8, 2013 at 5:32 pm
Hi,
I haven’t experienced that. Perhaps the Eclipse WTP is the place to ask https://www.eclipse.org/webtools/
katratxo
January 9, 2013 at 7:30 am
Hi Ivan,
great job, I’m working on a manual window and your post has been the base for my one; but I’ve a problem because I’m trying to add a widget in a form that should be a combobox related to sales region. SO I found a UI where it is used and I added this code (copyng from there:
{
name: ‘destination’,
title: ‘Destination’,
required: true,
columnName: ‘C_Salesregion_ID’,
inpColumnName: ‘inpcSalesregionId’,
refColumnName: ‘C_SalesRegion_ID’,
targetEntity: ‘SalesRegion’,
gridProps: {
sort: 2,
autoExpand: true,
editorProps: {
displayField: null,
valueField: null
},
displaylength: 32,
fkField: true,
showHover: true
},
type: ‘_id_144’
}
but ot just shows an empty combobox.
So I thought I’ve to add its datasource and other few fields:
{
name: ‘destination’,
title: ‘Destination’,
required: true,
columnName: ‘C_Salesregion_ID’,
inpColumnName: ‘inpcSalesregionId’,
refColumnName: ‘C_SalesRegion_ID’,
targetEntity: ‘SalesRegion’,
gridProps: {
sort: 2,
autoExpand: true,
editorProps: {
displayField: null,
valueField: null
},
displaylength: 32,
fkField: true,
showHover: true
},
type: ‘_id_144’,
init: function () {
this.optionDataSource = OB.Datasource.create({
dataURL: ‘/openbravo/org.openbravo.service.datasource/SalesRegion’
});
this.Super(‘init’, arguments);
},
displayField : ‘name’,
valueField:”id”,
defaultPopupFilterField : ‘name’,Roberto
popupTextMatchStyle : ‘startsWith’,
textMatchStyle : ‘startsWith’,
outHiddenInputPrefix : ‘inporigin’,
filterFields:[“name”]
}
With this code it ALMOST works, it has to problems:
1) it doesn’t filter when you type in the widget
2) It says “The entered value is a value not present in the list ….” when I select a value and give the focus to another widget
Please can you help me?
Tx a lot
Roberto
amicidirobertooberto
March 31, 2013 at 12:43 am