论坛首页 Web前端技术论坛

向大家介绍一个很棒的适合企业级开发的Ajax(yui-ext)

浏览 181797 次
该帖已经被评为良好帖
作者 正文
   发表时间:2007-03-07  
stcCallback1001({"totalCount":"2","topics":[
{"topic_id":"1","forum_id":"4","topic_title":"Need help loading treeNode with children data","topic_poster":"2332","topic_time":"1172806501","topic_views":"84","topic_replies":"3","topic_status":"0","topic_vote":"0","topic_type":"0","topic_first_post_id":"14810","topic_last_post_id":"15323","topic_moved_id":"0","username":"simeon","user_id":"2332","user2":"simeon","id2":"2332","post_username":"sssa","post_username2":"aaab","post_time":"1173104768","post_text":"I was able to get the tree control"},
{"topic_id":"2","forum_id":"5","topic_title":"Need help loading treeNode with children data","topic_poster":"2332","topic_time":"1172806501","topic_views":"84","topic_replies":"3","topic_status":"0","topic_vote":"0","topic_type":"0","topic_first_post_id":"14810","topic_last_post_id":"15323","topic_moved_id":"0","username":"simeon","user_id":"2332","user2":"simeon","id2":"2332","post_username":"sss","post_username2":"dfdf","post_time":"1173104768","post_text":"I was able to get the tree control"}
]})
0 请登录后投票
   发表时间:2007-03-07  
remote.jsp如上就可以出来结果了,用firebug查看原来的php页面的返回结果是前面带"stcCallback1001"
0 请登录后投票
   发表时间:2007-03-07  
我晕,真是这么回事

不过 我有问题,乱码怎么解决?
0 请登录后投票
   发表时间:2007-03-07  
http://www.yui-ext.com/forum2/topics-remote.php?start=0&limit=25&forumId=4&sort=lastPost&dir=DESC&_dc=1173173827938&callback=stcCallback1001

http://www.yui-ext.com/forum2/topics-remote.php?start=25&limit=25&sort=lastPost&dir=DESC&_dc=1173174277859&callback=stcCallback1002

bbs里的
0 请登录后投票
   发表时间:2007-03-08  
会不会alpha版才是这样呢?我记得tree里面也是用[{...},{...}]的格式,前面不需要stcCallback1001
0 请登录后投票
   发表时间:2007-03-08  
godson_2003 写道
我晕,真是这么回事

不过 我有问题,乱码怎么解决?


页面加<%@page language="java" contentType="text/html; charset=utf-8" %>
0 请登录后投票
   发表时间:2007-03-08  
billy119 写道
remote.jsp如上就可以出来结果了,用firebug查看原来的php页面的返回结果是前面带"stcCallback1001"


显示是可以显示了,可是排序、翻页等操作无效
0 请登录后投票
   发表时间:2007-03-08  
是这样,Action(remote.jsp)那里要根据传的参数
start=0&limit=12&sort=logdate&dir=ASC&_dc=1173315498733&callback=stcCallback1001
重新构造数据,

String callback=request.getParameter("callback");

List pageResult = ...;
int totalCount = ..;
String entityListName = ..;
try {
response.setContentType("text/xml;charset=utf-8");
JSONArray jsonArray = JSONArray.fromObject(pageResult);
response.getWriter().write(
callback+"({\"totalCount\":\"" + totalCount + "\",\""
+ entityListName + "\":" + jsonArray + "})");
} catch (IOException e) {
log.error(e);
}
0 请登录后投票
   发表时间:2007-03-08  
要用jquery包的话,需要加三个js.
jquery.js
jquery-plug.js
ext-jquery-adapter.js

要按顺序来吧!
0 请登录后投票
   发表时间:2007-03-08  
明白了,如果我要添加事件怎办?比如我要点击某一行可以弹出详细信息,难道我要在每一行添加<A href="javascript:xxx()">topic</A> ?
0 请登录后投票
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics