Ibm mobilefirst WL JSONStore排序键<;字段>;不是有效字符串之一

Ibm mobilefirst WL JSONStore排序键<;字段>;不是有效字符串之一,ibm-mobilefirst,jsonstore,Ibm Mobilefirst,Jsonstore,我在尝试进行findAll排序时出错: "Sort key dateis not one of the valid strings." 我的选项如下(我尝试了desc的不同格式,每个人都抛出了相同的“错误”): var options={sort:[{“date”:“desc”}]} 一切似乎都很好,JSONStore按预期工作,对返回的数据进行排序,我只想确保“错误”确实是worklight.js部分的错误,而不是我做错了什么 此函数用于检查worklight.js中的有效sortObj:

我在尝试进行findAll排序时出错:

"Sort key dateis not one of the valid strings."
我的选项如下(我尝试了desc的不同格式,每个人都抛出了相同的“错误”):

var options={sort:[{“date”:“desc”}]}

一切似乎都很好,JSONStore按预期工作,对返回的数据进行排序,我只想确保“错误”确实是worklight.js部分的错误,而不是我做错了什么

此函数用于检查worklight.js中的有效sortObj:

  /** Checks if sortObj is a valid sort object for a query
   *   @private
   */
  var __isValidSortObject = function(sortObj, searchFields, additionalSearchFields) {
    var propertiesValidated = 0,
    sortObjKey, sortStr;

    for (sortObjKey in sortObj) {
      if (sortObj.hasOwnProperty(sortObjKey)) {
        if (propertiesValidated > 0) {
          WL.Logger.trace('Sort object ' + JSON.stringify(sortObj) + ' has more than one property. Each object must have only one property.');
          return false;
        }

        //check is sortObjKey is lowerCase
       if (_.isUndefined(searchFields[sortObjKey.toLowerCase()]) && _.isUndefined(additionalSearchFields[sortObjKey.toLowerCase()])) {
          WL.Logger.trace('Sort key ' + sortObjKey + ' is not part of search fields: ' + JSON.stringify(searchFields) + ' or additional search fields: ' + JSON.stringify(additionalSearchFields));
          return false;
       }

       sortStr = sortObj[sortObjKey];

       //Check that the string that specifies sorting order says either "asc" or "desc"
       **if (__isString(sortStr) && sortStr.length > 0 && (/^(a|de)sc$/i.test(sortStr))) {
          WL.Logger.trace('Sort key ' + sortObjKey + 'is not one of the valid strings.');
          propertiesValidated++;
       } else {  
          // Here seems to be the problem, shouldn't the trace be before return false?
          return false;
       }**
      }
    }

    if (propertiesValidated === 0) {
      return false;
    }

    return true;
 };
您可以清楚地看到,当检查正常时,他们会执行WL.Logger.trace,并且应该在返回false之前执行

在JSONStore上使用sort的任何人也会收到此跟踪吗


平台版本:7.1.0.00.20160129-1923

我联系了IBM支持部门,他们确实确认这是一个缺陷,将在下一次构建中解决