Fixed issue 29857: When there are not linked items it appears "Loading"
authorNaroa Iriarte <naroa.iriarte@openbravo.com>
Thu, 28 May 2015 16:19:09 +0200
changeset 26823 1c6069a0eafa
parent 26822 3b83abdfcfff
child 26824 aed0c66779e9
child 26826 a95a68264f41
Fixed issue 29857: When there are not linked items it appears "Loading"

When there are no linked items, the linked items category section shows the message "Loading data..."
instead of the message "No items to show".

The problem was that the fact of not having any item category was not correctly handled.
In the initWidget function, when the linkedItemCategoryListGrid is created, in the function "dataArrived"
there was a condition which called the function that showed the correct message "No items to show" when the
startRow was '0' and when de endRow was '-1', the problem was that in this case of not having any linked Item
category, the endRow and the startRow where both '0', so, the correct message was never shown and it always shows
the message "Loading data...".
To fix this, the condition has been changed, now it is taking into account the length of the data, and if it
is '0' that means that there are not linked items so, the message "No items to show" is shown.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-linked-items.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-linked-items.js	Wed May 27 23:08:18 2015 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-linked-items.js	Thu May 28 16:19:09 2015 +0200
@@ -330,7 +330,7 @@
         this.emptyMessage = this.emptyDataMessage;
       },
       dataArrived: function (startRow, endRow) {
-        if (startRow === 0 && endRow === -1) {
+        if (this.data && this.data.getLength && this.data.getLength() === 0) {
           this.showNoRowsMessage();
         }
         return this.Super('dataArrived', arguments);