在extjs中的panel嵌入iframe,要求点击链接到iframe,iframe页面无刷新

tcm441224375 2015-06-29 12:32:14
[size=24px][size=12px][size=24px][size=18px][size=16px]部分代码如下
var info = {
name : "info",
type : "iframe",
height: "290",
title : "检验数据"
};
var page1 = new Sail.page({
name : "page_qua_item", //定义页面对象的唯一标识 名称
mode : 'list', //这只页面对象的运行模式:列表页面
haveNavi : true,
//localNaviText:"工艺质量管理>检验单据管理",
frames : {
name : "quaItem", //该frame对象的唯一标识
title : "quaItem", //标题文本
autoLoad : false,
//-------------------------------------------------------------------------------
//以JSON形式描述 frame 的构成(包含哪些 item)
//-------------------------------------------------------------------------------
items : [form1,gridMain,gridSub,info],

layoutConfig : {
columns : 2,
width:["40%","60%"]
},
layout : [
{
items:[{'name':"search",colspan:2}]
},
{
items:[{'name':"gridMain",'colspan':2}]
},
{
items:[{'name':"gridSub"},{'name':"info"}]
}
],
bindEvent2Items : function(){
//MachineOfWorkLine <!--获取车间下的处理段 --> workshopId
//GetQuaBillSection planId <!-- 根据检验计划ID获取生产工段信息 -->
var dt = new Date();
var beginTime = dt.format('Ymd');
var checkTime = dt.format('Ymd')+"235959";
$('开始检测时间').setValue(beginTime);
$('结束检测时间').setValue(checkTime);
var staId = "";
var matId = "";
var getUrl=getLoadUrl();
$('检测点').load(getUrl);
$('牌号').load("../../../DataDict?type=BrandByMatGroupQuaBill&cate=params&planId="+operParm);//加载成品或烟丝牌号
queryData();
var gridMain = $('gridMain');
var gridSub = $('gridSub');
gridMain.getButton('综合测试台').on('click',function(){
var sendData = {"planId":operParm};
var openUrl="../../statQuery/DTTestBench_QTMJB.html";//成品工艺
if(operParm=="402891e745df12eb0145dfb581fc0002")openUrl="../../statQuery/DTTestBench_all.html";//成型DT检测
else if(operParm=="4028917a4757ca6f01475bf5ade1000b")openUrl="../../statQuery/DTTestBench_QTMJB.html?flag=1";//成品工艺
else if(operParm=="4028917b45a6bbe80145a72d59d900a1")openUrl="../../statQuery/DTTestBench_QTMJB.html?flag=2";//车间
var re=Sail.open(openUrl,"add",sendData,1200,800);//打开一个1200*800的新页面
if(re=="ok")gridMain .load();
});
gridMain.getButton('新增').on('click',function(){
var sendData = {"planId":operParm};
var re=Sail.open("InspectionSheetAdd.html","add",sendData,900,600);
if(re=="ok")gridMain .load();
});

gridMain.getButton('删除').on('click',function(){
var keys=gridMain.getSelections("pid").join(":");
if (keys==''){
Ext.Msg.alert("提示","请选择要删除的数据!");
return;
}
if(confirm("确认要删除所选择的数据吗?")==false){
return;
}
var url ="../../../DataMap?funcname=delBill&ids="+keys;
var data ={};
var callback = function(flag,getData){
if(flag=="true"){
Ext.Msg.alert('提示:', "删除成功!");
gridMain .load();
}else{
Ext.Msg.alert('提示:', "删除失败!");
}
};
Sail.postData(url,data,callback);
});

gridMain.addAction('修改',function(id){
var re=Sail.open("InspectionSheetAdd.html","update",{"f_id":id},900,600);
if(re=="ok")gridMain.load();
});

gridMain.getButton('复检').on('click',function(){
var keys=gridMain.getSelections("pid").join(":");
var billList = gridMain.getSelections();
if (keys==''){
Ext.Msg.alert("提示","请选择要进行复检的数据!");
return;
}
if(billList.length!=1){
Ext.Msg.alert("提示","您只能选择一条记录进行复检!");
return;
}

var firstResult = gridMain.getSelections("firstResult");
// alert(firstResult);
if(firstResult!="2"){
Ext.Msg.alert("提示","只有初检不合格的记录才能进行复检操作!");
return;
}

var url ="../../../DataMap?funcname=recheck&ids="+keys;
var data ={};
var callback = function(flag,getData){
if(flag=="true"){
Ext.Msg.alert('提示:', "复检任务生成成功,请选择相关任务进行填写!");
gridMain .load();
}else{
Ext.Msg.alert('提示:', getData.dataset.response.content);
}
};
Sail.postData(url,data,callback);
});
gridMain.getButton('复制').on('click',function(){
var keys=gridMain.getSelections("pid").join(":");
var billList = gridMain.getSelections();
if (keys==''){
Ext.Msg.alert("提示","请选择要进行复制的数据!");
return;
}
if(billList.length!=1){
Ext.Msg.alert("提示","您只能选择一条记录进行复制!");
return;
}
var url ="../../../DataMap?funcname=copyBill&ids="+keys;
var data ={};
var callback = function(flag,getData){
if(flag=="true"){
Ext.Msg.alert('提示:', "复制任务生成成功,请选择相关任务进行填写!");
gridMain .load();
}else{
Ext.Msg.alert('提示:', getData.dataset.response.content);
}
};
Sail.postData(url,data,callback);
});
gridMain.on('rowclick',function(id,row,record){

staId = record.data.standardId;
matId = record.data.checkMatId;

var qryInfo = "billId:" + id;
$('gridSub').load("../../../DataMap?funcname=fetchBillThing&f_qryPars="+qryInfo);
});

gridSub.on('rowclick',function(id,row,record){
var stepId = record.data.stepId;
var stepType = record.data.stepType;
var dcId = record.data.dcId;
var stepCode = gridSub.getSelections("stepCode");
if((operParm=="4028917b45a6bbe80145a72d59d900a1"&&stepCode=="S001"&&dcId=="")
||(operParm=="402891e745df12eb0145dfb581fc0002"&&stepCode=="S001"&&dcId=="")){
// Ext.Msg.alert("提示","请执行测试台数据检验!");
$("info").setSrc("InspectionSheetAll.html");
return;
}
var standardId=gridMain.getSelections("standardId").join(":");
//$("info").setSrc("InspectionInfo.html?thingId="+id+"&stepId="+stepId+"&stepType="+stepType+"&staId="+staId+"&matId="+matId);
if((operParm=="4028917b45a6bbe80145a72d59d900a1"&&stepCode=="S001") //卷接工序
||(operParm=="402891e745df12eb0145dfb581fc0002"&&stepCode=="S001"))//成型工序
// ||operParm=="4028917a4757ca6f01475bf5ade1000b")
//$("info").setSrc("InspectionSheetAll.html?sdate="+sdate+"&brand="+brand+"&machine="+machine);
$("info").setSrc("InspectionSheetAll.html?dcId="+dcId+"&standardId="+standardId+"&operParm="+operParm);
else
$("info").setSrc("InspectionInfo.html?thingId="+id+"&stepId="+stepId+"&stepType="+stepType+"&staId="+staId+"&matId="+matId);
});

gridSub.addAction('查看',function(id){
var stepCode = gridSub.getSelections("stepCode");
var standardId=gridMain.getSelections("standardId").join(":");
var stepId = gridSub.getSelections("stepId");
var dcId = gridSub.getSelections("dcId");
if((operParm=="4028917b45a6bbe80145a72d59d900a1"&&stepCode=="S001"&&dcId=="")
||(operParm=="402891e745df12eb0145dfb581fc0002"&&stepCode=="S001"&&dcId=="")){
Ext.Msg.alert("提示","请执行测试台数据检验!");
$("info").setSrc("InspectionSheetDetail.html");
return;
}
if((operParm=="4028917b45a6bbe80145a72d59d900a1"&&stepCode=="S001")
||(operParm=="402891e745df12eb0145dfb581fc0002"&&stepCode=="S001"))
$("info").setSrc("InspectionSheetDetail.html?dcId="+dcId+"&standardId="+standardId+"&operParm="+operParm);
else $("info").setSrc("PhysicalDetails.html?thingId="+id+"&stepId="+stepId);
});

$('search').getButton('查询').on('click', function () {
queryData();
});
...全文
269 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
DaveLeeCN 2015-06-29
  • 打赏
  • 举报
回复
在点击事件内加入e.preventDefault,即:
$('search').getButton('查询').on('click', function () {
e.preventDefault();
        queryData();
         }); 
tcm441224375 2015-06-29
  • 打赏
  • 举报
回复
var info = { name : "info", type : "iframe", height: "290", title : "检验数据" };定义一个iframe 点击:gradMain中记录时赋值 $("info").setSrc("PhysicalDetails.html?thingId="+id+"&stepId="+stepId); 这个就有刷新才会出来 我现在是不要这个刷新 直接下面这个界面,就好像是在同一时间显示的 我这上面代码应该怎么修改,才接触就要改,请指教
引用 1 楼 DaveLeeCN 的回复:
在点击事件内加入e.preventDefault,即:
$('search').getButton('查询').on('click', function () {
e.preventDefault();
        queryData();
         }); 
Go 旅城通票 2015-06-29
  • 打赏
  • 举报
回复
链接设置target属性为iframe的name属性值即可在iframe中打开
<a href="xxx" name= "quaItem">xxxx</a>

87,883

社区成员

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

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