Ext.Ajax.request 使用示例

var mGrid = Ext.getCmp('regionMainGrid').getSelectionModel();
        if (mGrid.hasSelection()) {
            var record = mGrid.getLastSelected();
            Ext.Ajax.request({
                url: '/BscRegion/HasChildren',
                params: record.data,
                success: function (form, action) {
                    var successfully = Ext.decode(form.responseText).success;
                    if (successfully) {

                        Ext.MessageBox.down('#yes').setText('是?');  // 修T改?弹獭出?消?息¢提示?框ò的?按恪钮¥的?默?认?文?字?     
                        Ext.MessageBox.down('#no').setText('否?');

                        Ext.MessageBox.show({
                            title: this.msgTitle,
                            msg: '数簓据Y删?除y之?后ó无T法ぁ恢?复′,?是?否?确ā定¨删?除y??',
                            buttons: Ext.Msg.YESNO,
                            icon: Ext.Msg.QUESTION,
                            fn: this.onDeleteConfirm,
                            scope: this
                        });
                    } else {
                        Ext.Msg.alert("提示?", Ext.decode(form.responseText).msg + ",不?能ü删?除y!");
                    }
                },
                failure: function (form, action) {
                    Ext.Msg.alert("提示?", "操ù作痢失骸败悒?");
                },
                scope: this
            });
        } else {
            Ext.Msg.alert('提示?', '请?选?择?要癮删?除y的?数簓据Y!?');
        }
-------------------------------------------------------------------------------------------
mvc:
-----------------------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// 是?否?有瓺子哩节ú点?
        /// </summary>
        /// <param name="mRegion"></param>
        /// <returns></returns>
        public string HasChildren(Region mRegion)
        {
            string mReturnStr = string.Empty;
            Region mConditions;
            IList<Region> mRegions = new List<Region>();

            if (mRegion != null)
            {
                mConditions = new Region();
                mConditions.pId = mRegion.id;
                mRegions = RegionSrv.SelectByFields(mConditions);
            }

            if (mRegions.Count > 0)
            {
                return
                mReturnStr = @"{
                success: false,
                msg: '有瓺子哩节ú点?'}";
            }

            return
            mReturnStr = @"{
            success: true}";
        }

 

posted @ 2013-01-25 16:04  xust  阅读(412)  评论(0)    收藏  举报