details: /erp/devel/pi/rev/78b4051539de
changeset: 9804:78b4051539de
user: Martin Taal <martin.taal <at> openbravo.com>
date: Fri Jan 14 07:24:51 2011 +0100
summary: Added filter icon to signal filter state
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
| 49 +++++++++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
| 48 ++++-----
2 files changed, 67 insertions(+), 30 deletions(-)
diffs (206 lines):
diff -r 4503b69249d5 -r 78b4051539de
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
Fri Jan 14 07:21:38 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
Fri Jan 14 07:24:51 2011 +0100
@@ -74,9 +74,10 @@
initWidget: function(){
// prevent the value to be displayed in case of a link
- var i, field, formatCellValueFunction = function(value, record, rowNum,
colNum, grid){
+ var i, thisGrid = this, field, formatCellValueFunction = function(value,
record, rowNum, colNum, grid){
return '';
};
+
for (i = 0; i < this.fields.length; i++) {
field = this.fields[i];
if (field.isLink) {
@@ -88,6 +89,25 @@
field.formatCellValue = formatCellValueFunction;
}
}
+
+ this.filterEditorProperties = {
+ // is needed to display information in the checkbox field
+ // header in the filter editor row
+// isCheckboxField: function(){
+// return false;
+// },
+
+ actionButtonProperties: {
+ visibility: 'hidden',
+ disabled: true,
+ showDisabled: false,
+ initWidget: function() {
+ thisGrid.filterImage = this;
+ return this.Super('initWidget', arguments);
+ }
+ }
+ };
+
return this.Super('initWidget', arguments);
},
@@ -119,6 +139,27 @@
return ret;
},
+ // show or hide the filter button
+ filterEditorSubmit: function(criteria){
+ for (var prop in criteria) {
+ if (criteria.hasOwnProperty(prop)) {
+ var field = this.filterEditor.getField(prop);
+ if (this.isValidFilterField(field) && criteria[prop]) {
+ this.filterImage.show(true);
+ return;
+ }
+ }
+ }
+ this.filterImage.hide();
+ },
+
+ isValidFilterField: function(field) {
+ if (!field) {
+ return false;
+ }
+ return !field.name.startsWith('_');
+ },
+
// = exportData =
// The exportData function exports the data of the grid to a file. The user
will
// be presented with a save-as dialog.
@@ -165,7 +206,7 @@
height: 1,
width: '100%',
- initWidget: function() {
+ initWidget: function(){
this.btn = isc.OBGridLinkButton.create({});
this.btn.setTitle(this.title);
this.btn.owner = this;
@@ -173,7 +214,7 @@
return this.Super('initWidget', arguments);
},
- setTitle: function(title) {
+ setTitle: function(title){
this.btn.setTitle(title);
},
@@ -184,7 +225,7 @@
this.grid.cellClick(this.record, this.rowNum, this.colNum);
}
}
-
+
});
isc.ClassFactory.defineClass('OBGridLinkButton', isc.Button);
diff -r 4503b69249d5 -r 78b4051539de
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
Fri Jan 14 07:21:38 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
Fri Jan 14 07:24:51 2011 +0100
@@ -218,15 +218,6 @@
filterEditorType: 'StaticTextItem'
});
- this.filterEditorProperties = {
- isCheckboxField: function(){
- return false;
- },
- actionButtonProperties: {
- visibility: 'hidden'
- }
- };
-
this.Super('initWidget', arguments);
},
@@ -300,7 +291,10 @@
this.updateRowCountDisplay();
this.updateSelectedCountDisplay();
- if (this.targetRecordId) {
+ if (this.targetOpenGrid) {
+ // don't need to do anything here
+ delete this.targetOpenGrid;
+ } else if (this.targetRecordId) {
this.delayedHandleTargetRecord(startRow, endRow);
} else if (this.view.shouldOpenDefaultEditMode()) {
this.view.openDefaultEditView(this.getRecord(startRow));
@@ -324,7 +318,9 @@
}
recordIndex = this.getRecordIndex(gridRecord);
- this.targetRecordId = null;
+ // don't need it anymore
+ delete this.targetRecordId;
+
if (data.criteria) {
data.criteria._targetRecordId = null;
}
@@ -353,16 +349,16 @@
}
},
- selectRecordById: function(id) {
- var recordIndex, gridRecord = this.data.find(OB.Constants.ID, id);
-
- // no grid record found, stop here
- if (!gridRecord) {
- return;
- }
- recordIndex = this.getRecordIndex(gridRecord);
- this.scrollRecordIntoView(recordIndex, true);
- this.doSelectSingleRecord(gridRecord);
+ selectRecordById: function(id){
+ var recordIndex, gridRecord = this.data.find(OB.Constants.ID, id);
+
+ // no grid record found, stop here
+ if (!gridRecord) {
+ return;
+ }
+ recordIndex = this.getRecordIndex(gridRecord);
+ this.scrollRecordIntoView(recordIndex, true);
+ this.doSelectSingleRecord(gridRecord);
},
filterData: function(criteria, callback, requestProperties){
@@ -567,19 +563,19 @@
// selectionChanged is called when the user makes changes
selectionChanged: function(record, state){
-
+
this.stopHover();
// enable/disable the delete if there are records selected
this.view.toolBar.setLeftMemberDisabled(isc.OBToolbar.TYPE_DELETE,
(!this.getSelection() || this.getSelection().length === 0));
-
+
// nothing changed, go away then, happens when saving
if (state && this.view.lastRecordSelected && record &&
this.view.lastRecordSelected.id === record.id) {
// instance may have been updated, update the instance in the view
this.view.lastRecordSelected = record;
return;
}
-
+
// stop editing if the selection is changing
var rowNum = this.getRecordIndex(record);
@@ -601,7 +597,7 @@
// selectionUpdated is called when the grid selection is changed
// programmatically
selectionUpdated: function(record, recordList){
-
+
isc.Log.logDebug('Selection updated ' + record, 'OB');
this.updateSelectedCountDisplay();
this.view.recordSelected();
@@ -929,7 +925,7 @@
this.OBGridToolStrip.hideMember(3);
},
- toggleProgressIcon: function(toggle) {
+ toggleProgressIcon: function(toggle){
if (toggle) {
this.progressIcon.show();
this.OBGridToolStrip.hide();
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits