我在一个由视图填充的表单上有一个网格。我添加了一个按钮来过滤数据。
@Repository
public class ApplyLeaveEntityDaoImpl implements ApplyLeaveEntityDao {
private static final Logger LOG = Logger
.getLogger(ApplyLeaveEntityDaoImpl.class);
@Autowired
private SimpleJdbcTemplate misJdbcTemplate;
@Autowired
private JdbcTemplate jdbcTemplate;
private static final class EmailBasedApprovalSickFilePathMapper implements
RowMapper<EmailBasedApprovalSickFilePath> {
@Override
public EmailBasedApprovalSickFilePath mapRow(ResultSet rs, int rowNum)
throws SQLException {
EmailBasedApprovalSickFilePath emailBasedApprovalSickFilePath = new EmailBasedApprovalSickFilePath();
emailBasedApprovalSickFilePath.setId(rs.getInt("id"));
emailBasedApprovalSickFilePath.setFileName(rs.getString("filename"));
emailBasedApprovalSickFilePath.setFilePath(rs.getString("filepath"));
return emailBasedApprovalSickFilePath;
}
}
@Override
public EmailBasedApprovalSickFilePath getFilePath(final int leaveID){
System.out.println("leaveID"+leaveID);
String sql = "select filename,filepath from "
+ "lms_mas_sickleavefilepath where leaveid = ?";
System.out.println("sql"+sql);
EmailBasedApprovalSickFilePath emailBasedApprovalSickFilePath;
try {
emailBasedApprovalSickFilePath = misJdbcTemplate.queryForObject(
sql.toString(), new EmailBasedApprovalSickFilePathMapper(),
leaveID);
System.out.println("file name"+emailBasedApprovalSickFilePath.getFileName());
}
catch (EmptyResultDataAccessException e) {
System.out.println("e"+e);
e.printStackTrace();
emailBasedApprovalSickFilePath = null;
}
return emailBasedApprovalSickFilePath;
}
}
我收到“找不到变量cFilter”错误。我不明白的是,上述代码已经运行后出现错误;在调试器中,有罪方法表示为“MyForm.grdDDP”。没有其他的。我怎样才能找到它实际寻找这个变量的位置?
答案 0 :(得分:3)
变量cFilter必须是一个全局的代码才能工作。
如果您不想使用全局变量,可以执行以下操作。
cFilter = UPPER(ALLTRIM(INPUTBOX("Filter sur :","Spectech France - Suivi DDP")))
SELECT vwDdp_all
LOCATE FOR ALLTRIM(ref_client) = cFilter
IF FOUND()
lcFiltClause = [ref_client = ']+cFilter+[']
SET FILTER TO &lcFiltClause
THISFORM.grdDDP.Column10.SetFocus
ENDIF
答案 1 :(得分:1)
在绑定游标中导航时,过滤器表达式必须始终可见。你可以这样做:
var self = this;
this.getProductReferences = function(productId) {
return $http.get('database.json').success(function(database) {
var product = _.find(database.products, function(product) {
return product._id == productId;
});
return product.references;
});
};
// this could be wrapped in a func that is called from your html
this.getProductReferences("5769484bb3ef5c696c5686d0").then(function(result) {
self.references = result.data.team_members;
})
但是,设置过滤器是几乎所有开发人员在“不使用”列表中拥有它的命令之一。特别是对于网格,您不应使用“设置过滤器”。相反,您可以简单地使用查询作为网格的来源。或者,如果该ref_client是一个索引字段,那么您可以改为使用“设置范围”(它不需要全局变量或任何&amp;技巧)。