Ext弹出新页面

andy1217 2011-08-10 11:36:45
operationHelpbill:function(){
urls = this.baseUrl;
var node=this.id.substr(4);
Ext.Ajax.request({
url: urls+"?cmd=operationHelpbill&pdfName="+node,
method: "POST",
timeOut: 25000,
async: false,
success: function(response, opts)
{
var r = Ext.util.JSON.decode(response.responseText);
if(r.success){
//这里应该怎么写?
}else{
Ext.MessageBox.alert("提示信息","说明不存在!");
}
}
});
},

public void operationHelpbill(String fileName) throws Exception {
String path = ConfigHelper.findValueByKey("common/System.properties","upload.imgServer")
+ ConfigHelper.findValueByKey("common/System.properties","upload.img.root")
+ ConfigHelper.findValueByKey("common/System.properties","upload.pdf.fengkong");
String comm ="{success:false}";
String url = path + "/"+ fileName + ".pdf";
//这里应该怎么把URL传到页面呢?
}

我想通过页面上点击按钮打开一个新页面通过浏览器查看PDF文件,上面个是按钮的function,下面个是调用的后台方法
...全文
482 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
andy1217 2011-08-12
  • 打赏
  • 举报
回复
window.open(url);
直接这样就能达到我要的效果,谢谢各位
andy1217 2011-08-12
  • 打赏
  • 举报
回复
对,楼上的说对老
csdn的黄公子 2011-08-10
  • 打赏
  • 举报
回复
/套餐操作工具栏
var bar2 = new Ext.Toolbar({
items: [

{
text: '管理图片',
iconCls: 'update',
handler: function () { ProductTabPanel(2); }
}, {
text: "打开详情页面",
iconCls: "connect",
handler: function () {
var row = Ext.getCmp("ProductGrid").getSelectionModel().getSelections();
if (row.length <= 0) {
Ext.Msg.alert("提示信息", "请选择一个!");
}
else if (row.length > 1) {
Ext.Msg.alert("提示信息", "只能选择一个!");
}
// window.open("/Gplugin/ShopProducts/ProductPro.aspx?id=" + row[0].data.Productid);
window.open("/ShopProducts/ProductPro/" + row[0].data.Productid + ".html");
}
}, {
text: '导出Execl',
iconCls: 'ShowExecl',
handler: function () {
//操作Execl导出
var value = Ext.getCmp("SearchCom").getValue();
var key = Ext.getCmp("SearchKey").getValue();
var isshow = Ext.getCmp("ShowCom").getValue();
key = escape(key);
value = escape(value);
window.open("/Gplugin/CMS/ExeclList/ProExecl.aspx?key=" + key + "&value=" + value + "&isshow=" + isshow);

}
}


window.open直接跳转的行不
班门弄斧 2011-08-10
  • 打赏
  • 举报
回复
后台得到URL准备传到前台

public void operationHelpbill(String fileName) throws Exception {
String path = ConfigHelper.findValueByKey("common/System.properties","upload.imgServer")
+ ConfigHelper.findValueByKey("common/System.properties","upload.img.root")
+ ConfigHelper.findValueByKey("common/System.properties","upload.pdf.fengkong");
String comm ="{success:false}";
String url = path + "/"+ fileName + ".pdf";
//这里应该怎么把URL传到页面呢?
Response.Write(@"{url :'" + url + "'}");
}


接收后台返回的response.responseText,从而得到当中的url

//获得AJAX返回的url
var urls=Ext.util.JSON.decode(response.responseText).url;
//将url传递给函数
operationHelpbill:function(urls){
urls = this.baseUrl;
var node=this.id.substr(4);
Ext.Ajax.request({
url: urls+"?cmd=operationHelpbill&pdfName="+node,
method: "POST",
timeOut: 25000,
async: false,
success: function(response, opts)
{
var r = Ext.util.JSON.decode(response.responseText);
if(r.success){
//这里应该怎么写?
var s1 = new Ext.data.Store({
reader: new Ext.data.JsonReader({}, [{ name: "Id" }, { name: "name"}]),
data: [{ id: "1", name: "name1"}]
});
var g1 = new Ext.grid.GridPanel({
store:s1,border: false, loadMask: { msg: "正在加载..." }, viewConfig: { forceFit: true },
columns: [{ header: "姓名", dataIndex: "name", sortable: true}]
});
var win = new Ext.Window({
title: "查询", width: 500, height: 350, constrain: true, layout: "fit",items:g1
});
win.show();
}else{
Ext.MessageBox.alert("提示信息","说明不存在!");
}
}
});
},


豆虫 2011-08-10
  • 打赏
  • 举报
回复
楼主的意思是 想点击按钮 在弹出的Ext window中呈现pdf文档 是这样么
andy1217 2011-08-10
  • 打赏
  • 举报
回复
你在function里是怎么用这个url的?
班门弄斧 2011-08-10
  • 打赏
  • 举报
回复
后台先Response.Write(@"{url :'" + url + "'}");
andy1217 2011-08-10
  • 打赏
  • 举报
回复
//获得AJAX返回的url
var urls=Ext.util.JSON.decode(response.responseText).url; //你这里获取后没看明白你是怎么用的?
//将url传递给函数
operationHelpbill:function(urls){
urls = this.baseUrl;
var node=this.id.substr(4);
Ext.Ajax.request({
url: urls+"?cmd=operationHelpbill&pdfName="+node, //这里是按钮的ACTION请求
method: "POST",
timeOut: 25000,
async: false,
success: function(response, opts)
{
var r = Ext.util.JSON.decode(response.responseText);
if(r.success){
//这里应该怎么写?
var s1 = new Ext.data.Store({
reader: new Ext.data.JsonReader({}, [{ name: "Id" }, { name: "name"}]),
data: [{ id: "1", name: "name1"}]
});
var g1 = new Ext.grid.GridPanel({
store:s1,border: false, loadMask: { msg: "正在加载..." }, viewConfig: { forceFit: true },
columns: [{ header: "姓名", dataIndex: "name", sortable: true}]
});
var win = new Ext.Window({
title: "查询", width: 500, height: 350, constrain: true, layout: "fit",items:g1
});
win.show();
}else{
Ext.MessageBox.alert("提示信息","说明不存在!");
}
}
});
},

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧