--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js Mon Jan 03 21:44:36 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js Mon Jan 03 22:47:04 2011 +0100
@@ -103,6 +103,26 @@
isc.OBSearchItem.addProperties({
showPickerIcon: true,
+ setValue: function(value) {
+ var ret = this.Super('setValue', arguments);
+ // in this case the clearIcon needs to be shown or hidden
+ if (!this.disabled && !this.required) {
+ if (value) {
+ this.showIcon(this.instanceClearIcon);
+ } else {
+ this.hideIcon(this.instanceClearIcon);
+ }
+ }
+ return ret;
+ },
+
+ init: function() {
+ this.instanceClearIcon = isc.shallowClone(this.clearIcon);
+ this.icons = [this.instanceClearIcon];
+ this.icons[0].formItem = this;
+ return this.Super('init', arguments);
+ },
+
getTitleHTML: function() {
// calls the method from the OBLinkTitleItem interface
return this.getLinkTitleHTML();
--- a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.js Mon Jan 03 21:44:36 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.js Mon Jan 03 22:47:04 2011 +0100
@@ -15,9 +15,7 @@
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
-*/
-
-
+ */
isc.OBViewForm.addProperties({
styleName: 'OBViewForm',
//cellBorder: 1, // debug layout
@@ -48,6 +46,30 @@
pickerIconHeight: 21,
pickerIconWidth: 21,
pickerIconSrc: '[SKINIMG]../../org.openbravo.client.application/images/form/search_picker.png',
+ clearIcon: {
+ height: 15,
+ width: 15,
+ // note: TODO: show a helpfull text, need to be present in the messages table
+ //prompt: 'test',
+ showIf: function(form, item){
+ if (item.disabled) {
+ return false;
+ }
+ if (item.required) {
+ return false;
+ }
+ if (item.getValue()) {
+ return true;
+ }
+ return false;
+ },
+
+ click: function() {
+ this.formItem.clearValue();
+ },
+
+ src: '[SKINIMG]../../org.openbravo.client.application/images/form/clear-field.png'
+ },
newTabIconSrc: '[SKINIMG]../../org.openbravo.client.application/images/form/ico-to-new-tab.png',
newTabIconSize: 8
});