1.问题:TypeError: Error #1009: 无法访问空对象引用的属性或方法。
原因:当flex顺序执行第一个NavigatorContent之后,后面的NavigatorContent就不再主动执行,没执行就没生成对象,它的实例为空的。
解决方法:不在页面初始化加载的时候做其他tab查询
protected function tabnavigator1_changeHandler(event:IndexChangedEvent):void { switch(event.newIndex){ case 0: //tab0.initApp(); break; case 1: newsTab(); break; case 2: annouTab(); break; } }
public function newsTab():void { selectAllNewsResult.token = associationNewsNewsAction.selectAllNews(assoc,newsPagebar.PageIndex,newsPagebar.pageSize); // TODO Auto-generated method stub }
2.问题:给分页查询添加查询条件。
解决方法:首先,需要把查询的条件传给action,然后,你需要组装where条件,在查询的时候,他会自动给你加 “where”关键字
public DataStore selectAllNews(ASSOCIATION assoc, int page, int rowCount) {
try {
SplitPageInfo pageInfo = PageUtil.getPageInfo(page, rowCount);
StringBuffer sbSqlWhere = new StringBuffer();
sbSqlWhere.append(" assoc_id=").append(assoc.getAssoc_id());
pageInfo.setSbSqlWhere(sbSqlWhere.toString());
List<NEWS> records = news.selectAllNews(pageInfo);
return new DataStore(records, pageInfo);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;