我有网格列(bookId,status,requestId,authorId,price),我希望发送到 服务器只有列(status ='sell')
的行 var request = {
bookId: grid.getBookId(),
info: []}
store.each(function(rec, index, length) {
request.info.push({
requestId: rec.get('index'),
authorId: rec.get('authorId'),
price: rec.get('price')
}); });
如何在发送到服务器时创建条件
答案 0 :(得分:0)
如果您只想在请求中添加特定记录,只需在将它们添加到数组之前使用if子句:
store.each(function(rec, index, length) {
if (rec.get('status') == 'sell') {
request.info.push({
requestId: rec.get('index'),
authorId: rec.get('authorId'),
price: rec.get('price')
});
}
});