【问题标题】:dojo grid: sending filter criteria to server, with valid datesdojo 网格:将过滤条件发送到服务器,日期有效
【发布时间】:2013-10-23 05:14:29
【问题描述】:

我有一个带有 JsonRest 对象的 Dojo EnhancedGrid,该对象包装在 ObjectStore 中。我想将过滤条件发送到服务器。

我的代码几乎是这样的:

var myStore = new JsonRest({target:"data.jsp"});
var grid = new dojox.grid.EnhancedGrid({
  store: dataStore = new ObjectStore({objectStore: myStore}),
  id:"grid",
  query: { fileId: "*" },
  structure:"mystructure",
  plugins:{
    filter: {
      isServerSide: true,
      setupFilterQuery: setupFilter
    }
  }
});
var setupFilter = function(commands, request){
  if(commands.filter && commands.enable){
    request.query.filter = JSON.stringify(commands.filter);
  }
};

问题是 commands.filter 似乎没有保存有效的日期对象。在 Firefox 的代码调试器中查看它,它似乎包含数字(内存地址?)日期应该在哪里。

JSON.stringify(commands.filter) 在日期范围查询中的示例结果是:

{"op":"all","data":[{"op":"largerEqual","data":[{"op":"date","data":"uploadDate","isCol ":true},{"op":"date","data":1382706000000,"isCol":false}]},{"op":"lessEqual","data":[ {"op":"date","data":"uploadDate","isCol":true},{"op":"date","data":1381150800000,"isCol":假}]}]}

如何在过滤条件中包含有效日期?

【问题讨论】:

    标签: javascript date dojo dojox.grid


    【解决方案1】:

    数字值很可能是自 1970/01/01 以来的日期(以毫秒为单位)

    例如...

    var a = new Date(1382706000000);

    现在,如果您检查 a 在调试器中的内容或将其注销,您应该会看到它是一个日期对象。

    我退出了:Fri Oct 25 2013 14:00:00 GMT+0100 (GMT Daylight Time)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-29
      • 1970-01-01
      相关资源
      最近更新 更多