
<ext:Button ID="Button5" runat="server" Text="保存" Icon="Accept" Width="80" >
<Listeners>
<Click Fn="SaveData" />
</Listeners>
</ext:Button>
<script type="text/javascript">
function SaveData() {
if (ctl00_ContentPlaceHolder1_cmbStagegetText() == "") {
alert("请先选择Stage");
return;
}
var records = ctl00_ContentPlaceHolder1_GridPanel2storegetRange();
var s="";
if (recordslength > 0) {
for(var i=0; i<recordslength; i++)
{
s+=records[i]dataID+",";
}
}
ExtnetDirectMethodsSaveData(s);
}
</script>
var grid = new ExtgridGridPanel({ cm : new ExtgridColumnModel([{header : '按钮,xtype : 'actioncolumn',width : 90,align : 'center',items : [{text: '按钮'}]}])});
var cerficicationData = [{
'key' :'', 'value' :'全部'
}, {
'key' :'0', 'value' :'无证'
}, {
'key' :'1', 'value' :'有证'
}];
var cerficicationStore = new ExtdataSimpleStore( {
fields : [ { name :'key', mapping :'key' }, { name :'value', mapping :'value' } ],
data : cerficicationData
});
var expBaseForm = new ExtFormPanel( {
url :'',
method :'post',
labelAlign :'right',
labelWidth :90,
frame :true,
bodyStyle :'padding:0px 0px 0',
items: [{
id:'comboValue',
width:180,
layout:'form',
fieldLabel:'是否有毕业证',
xtype:"combo",
valueField:"key",
displayField:"value",
hiddenName:"certificateFlag",
height:100,
width:200,
store:cerficicationStore,
mode : 'local',//数据模式,local代表本地数据
triggerAction : 'all'// 显示所有下列数据,一定要设置属性triggerAction为all
}]
});
var winIcsQuestionnaireData = new ExtWindow( {
layout : 'fit',
width : 300,
closeAction : 'hide',
height : 200,
closable : false,
resizable : false,
shadow : true,
modal : true,
closable : true,
bodyStyle : 'padding:5 5 5 5',
animCollapse : true,
items: expBaseForm,
buttons : [{
text :'确定',
handler : function() {
alert(ExtgetCmp('comboValue')value());
}
},{
text:'关闭',
winIcsQuestionnaireData hide();
}
}]
});
假如你把样式和都copy了,而且样式中的路径正确的话,那样就在html中导入样式,例如
<link rel="stylesheet" type="text/css" href="<%=requestgetContextPath()%>/css/ext-allcss" />
然后就使用:<button class="x-btn" value="提交"></button>
这样试下行不
首先有一个按钮,并且有监听click的事件
var button = new ExtButton({
text : "button",
listeners :{
click : function(){
alert("111");
}
}});
然后ajax返回成功后
ExtAjaxrequest({
url : "",
method : "post",
params : {
},
success : function(response) {//成功的返回
var result = Extdecode(responseresponseText);
if (true === resultsuccess) {//返回后台成功的信息
//在这里触发那个按钮的点击事件就可以了
buttonfireEvent('click');
}
}
})
fireEvent ( String eventName, Object args ) : Boolean
触发指定的事件,并将欲执行的处理函数的参数传入。(应该至少要有事件的
触发指定的事件,并将欲执行的处理函数的参数传入。(应该至少要有事件的名称)
参数项:
eventName : String
事件名称
args : Object
传入事件处理函数(Event Handlers)的参数
返回:
Boolean 如果有处理函数返回true或者false
ExtMsgshow({
title:'Milton',
msg:'Haveyouseenmystapler',
buttons:ExtMsgYES
});
ExtMsgshow({
title:'Milton',
msg:'Haveyouseenmystapler',
buttons:ExtMsgYESNO
});
这中方式是使用Msg默认的button,ext默认有下面几种button组合
ExtMessageBoxOK
ExtMessageBoxYES
ExtMessageBoxNO
ExtMessageBoxCANCEL
ExtMessageBoxOKCANCEL
ExtMessageBoxYESNO
ExtMessageBoxYESNOCANCEL
基本够用。
如果你想自定义button,可以采用下面的方法
ExtMessageBoxshow({
title:'Milton',
msg: 'Haveyouseenmystapler',
buttonText: {yes:'Button1', no:'Button2'},
fn: function (btn) {
consolelog(btn);
}
});
当然,buttonText中的yes和no也都需要是在ExtMessageBox中定义过得。其实无非就是换个名字,原来叫yes,你现在自定义成Button1了。
var segmentedButton = Extcreate('ExtSegmentedButton', {
allowMultiple: true,//是否允许多个按钮为按下状态
items: [
{
text: '按钮一'
},
{
text: '按钮二'
},
{
text: '按钮三'
}],
listeners: {
//toggle当segmentedButton组件中任何状态发生改变时触发
//参数:(segmentedButton本身,发生改变的按钮,bool类型true为按下状态)
toggle: function (container, button, pressed) {
if (pressed)
alert("用户按下了'" + buttongetText() + "'按钮");
else
alert("用户松开了'" + buttongetText() + "'按钮");
}
}
});
var myToolbar = Extcreate('ExtToolbar', {
id: "mytoolbar",
docked: 'top',
layout: {
type:'hbox',
pack:'end'
},
items: [segmentedButton]
});
function openPanel(node) {
var n = contentPanelgetComponent(nodeid); if (!n) { //判断是否已经打开该面板 n = contentPaneladd({ 'id':nodeid, 'title':nodetext, closable:true, html:'<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="'+nodeattributesvisitUrl+'"></iframe>' }); } contentPanelsetActiveTab(n); }
为你的button添加上面的 函数 当然改就需要你的了
tabpanel为你的 setActiveTab
以上就是关于asp.net ext:Button 怎么调用js方法全部的内容,包括:asp.net ext:Button 怎么调用js方法、EXTJS的Grid 怎样在第一列添加加button、ext怎么在d出窗口显示一个下拉框 并且获取到这个下拉框的值!等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)