ExtJSのコンボをリンクし、表示、編集可能なグリッド線に追加プラスシフトダウン。。。

{
                    テキスト: '部门'、
                    幅:250、
                    アライメント: 'センター'を、
                    MENUDISABLED:、真の
                    'DEPTNAME':dataIndex
                    エディタ:{
                        XTYPE: 'treepicker'、
                        編集可能な値:false、
                        containerScroll:真、
                        forceSelection:真、
                        名前: 'DEPTNAME'、
                        参照: 'DEPTNAME'、
                        店舗:Ext.create( 'JsApp.store.currency.DepartmentalSourceStore'、{
                            ID: 'departmentalsourceストア」
                        })、
                        リスナー:{
                            '選択': 'onSelectDataSourceColumnClick'
                        }、
                        マージン:0 5 0 0 '、
                        displayField: 'テキスト'、
                        valueField: 'ID'
                    }、
                    レンダラ'renderCirculationDeptField'
                }、
                {
                    テキスト:「办理人员」、
                    幅:480、
                    整列: '中央'、
                    dataIndex: 'ユーザー名'、
                    エディタ。{
                        XTYPE: 'コンボ'、
                        編集可能:偽、
                        queryMode: 'ローカル'、
                        複数選択:真、
                        名称: 'ユーザー名'、
                        参照: 'combouserName'、
                        店舗:Ext.create( 'JsApp.store.currency.UserSourceStore'、{
                            ID: 'usersourceストア'
                        })、
                        マージン:0 5 0 0 '、
                        displayField: 'ユーザー名'、
                        valueField 'userUid'、
                        listConfig:{
                            itemTpl:Ext.create( 'Ext.XTemplate'、「<入力タイプ=チェックボックス> {[values.userName]} ')、
                            //设置默认值
                            onItemSelect:関数(レコード){
                                VARノード= this.getNode(レコード)。
                                IF(ノード){
                                    Ext.fly(ノード).addCls(this.selectedItemCls)。
                                    VaRのcheckboxs = node.getElementsByTagName( "入力")。
                                    IF(!checkboxs = NULL){
                                        VARチェックボックス= checkboxs [0]。
                                        checkbox.checked =はtrue。
                                    }
                                }
                            }、
                            リスナー:{
                                によってitemClick: 'selectUserName'
                            }
                        }
                    }、
                    リスナー:{
                        クリック'onClickCell'
                    }、
                    レンダラ'renderCirculationUserField'
                }
            ]、
            tbar:[ ' - >'、
                {
                    テキスト: '置顶'、
                    iconCls:「FAS FA -arrow円アップ」、
                    ハンドラ『onTopclick』
                }、
                {
                    テキスト: '上移'、
                    iconCls: 'FAS FA-矢印アップ'、
                    ハンドラ'onUpclick'
                }、{
                    テキスト: '下移'、
                    iconCls: 'FAS FA-矢印ダウン'、
                    ハンドラ'onDownclick'
                } 、{
                    テキスト: '置底'、
                    iconCls: 'FAS FA-矢印円ダウン'、
                    ハンドラ'onBottomclick'
                }]

 

 

 / *
     *異なるセクタを選択する
     * /
    onSelectDataSourceColumnClick:関数(コンボ、レコード、eOpts){
        VAR = Meの本、
            参考文献の=のme.getReferences()、
            グリッド参考文献= [ "CirculationDeptGridForm"]、
            ストアgrid.getStore =();
        store.find isSelection = VAR( 'DEPTCODE'、combo.value);
        IF(isSelection == -1){
            VAR editline = grid.getSelectionModel()getSelection();. //ライン現在編集得る
            場合(editline.length <1){
                リターン;
            }
            editColumnRecord editline = [0];
            !IF(editColumnRecord = NULL){
                editColumnRecord.set( 'deptcode'、record.data.id) ; // 書き込み線データ
            }
        }
        他{
            combo.setValue(NULL);
            me.toastOk( "既にこの分野に存在する");
            を返します;
        }
    }、

 

 / **
     *渲染部门字段
     * /
    renderCirculationDeptField:関数(値、レコード、dataIndex、セル、列、gridStore){
        私VAR =この、
            店舗= Ext.StoreManager.get( 'departmentalsource店舗')。
        {みてください
            。( 'テキスト')を取得store.getAt(store.find( 'ID'、値))を返します。
        }
        キャッチ(E){}
    }、

//選択トランザクタ
    selectUserName:機能(表示、記録、商品、指数、E、eOpts){
        VAR = Meのこの、
            フォーム= me.view、
            参考文献の=のme.getReferences()、
            コンボ参考文献= [ "combouserName"]、
            AllCheckBox = {//工場userUid全体ボックスのuserName(ストア)データソースと一致しているべきである
                ユーザー名: "選択"、
                userUid: "すべて"
            }、
            newValues = []、
            selectclass = item.classList;
        IF( == AllCheckBox.userName item.innerText){
            VAR isSelected = item.getElementsByTagName( "入力")[0] .checkedを; // trueとfalseに完全ボックスかどうかをチェック
            VAR itemSelected = selectclass.contains( 'X-boundlist選択 ')。
            {(!isSelected && itemselected)場合
                {Ext.each(record.store.data.items、関数(項目)
                    !(item.data.userUid = "ALL"){場合
                        newValues.push(item.data.userUid)。
                    }
                })。
                combo.setValue(newValues)。
            }
            他{
                (!itemselected){もし
                    Ext.each(record.store.data.items、関数(アイテム){
                        (item.data.userUid!= "ALL"){もし
                            newValues.push(item.data.userUid) ;
                        }
                    })。
                }
                他{
                    Ext.each(view.all.elements、関数(アイテム){
                        item.getElementsByTagName( "入力")[0] =偽.checkedを;
                    });
                    newValues.push( "すべて")。
                }
                combo.setValue(newValues)。
            }
        }
        他{
            VAR指数= combo.getValue()のindexOf( 'すべて')。
            もし(指数> -1){
                combo.getValue()(インデックス1)スプライス。
                combo.setValue(combo.getValue())。
                VAR入力= view.all.elements [0]。
                {(input.innerText == "全选")場合
                    input.getElementsByTagName( "入力")[0] =偽.checkedを。
                    item.getElementsByTagName( "入力")[0] =偽.checkedを。
                }
            }
            他{
                item.getElementsByTagName( "入力")[0] =偽.checkedを。
            }
        }

    }、

//点击行
    onClickCell:機能(ビュー、rowIndexに、colIndex、アイテム、例えば、レコード、列){
        VAR私=この、
            参考文献=のme.getReferences()、
            コンボ=参考文献[ "combouserName"]。
        VAR UserSourceStore = Ext.StoreManager.get( 'usersource店舗')。
        UserSourceStore.load({
            paramsは:{
                DEPTID:record.data.deptname
            }、
            コールバック:関数(レコード、オプション、成功){
                IF(records.length - 1 == record.data.userName.length){
                    record.data。 userName.push( "すべて");
                }
                場合(record.data.userName.length> 0 &&コンボ!
                    combo.setValue(record.data.userName)。
                }
            }
        })。
    }、

 

/ **
     *渲染办理人员字段
     * /
    renderCirculationUserField:関数(値、レコード、細胞、dataIndex、カラム、gridStore){
        私VAR =この、
            店舗= Ext.StoreManager.get( 'usersource店舗')。
        store.load({
            paramsは:{
                記号: "全"
            }
        })。
        VaRのテキスト=新しいアレイ(value.length)。
        {試みる
            {(私は++; iはvalue.lengthを<VAR I = 0)のため
                。( 'ユーザ名')を取得テキスト[I] = store.getAt(store.find( 'userUid'、値[I]))。
            }
            テキストを返します。
        }
        キャッチ(E){}
    }、

 

//上移
    onUpclick:関数(){
        私VAR =この、
            参考文献の=のme.getReferences()、
            グリッド=参考文献[ "CirculationDeptGridForm"]、
            店舗= Ext.StoreManager.get( 'usersource店舗')、
            rowSelectionModel =グリッド.getSelectionModel()。
        IF(rowSelectionModel.hasSelection()){
            VARレコード= rowSelectionModel.getSelected()GetAt機能(0)。
            store.load({
                paramsは:{
                    DEPTID:record.data.deptname
                }、
                コールバック:関数(レコード、オプション、成功){
                    VAR指数= grid.store.indexOf(レコード)。
                    IF(指数> 0){
                        grid.store.removeAt(インデックス);
                        grid.store.insert(インデックス- 1、レコード。);
                        grid.getSelectionModel()を選択し(インデックス- 1);.
                    }
                }
            });
        }他{
            Ext.Msg.alert( 'プロンプト' 'に移動するように選択する行!');
        }
    }
    //ダウン
    onDownclick:関数(){
        VAR = Meの本、
            参考文献の=のme.getReferences()、
            グリッド=参考文献【 "CirculationDeptGridForm"]、
            ストアExt.StoreManager.get =( 'usersource-ストア')、
            rowSelectionModel = grid.getSelectionModel()。
        IF(rowSelectionModel.hasSelection()){
            VARレコード= rowSelectionModel.getSelected()GetAt機能(0)。
            store.load({
                paramsは:{
                    DEPTID:record.data.deptname
                }、
                コールバック:関数(レコード、オプション、成功){
                    VAR指数= grid.store.indexOf(レコード);
                    IF(指数<grid.store.getCount( ) - 1){
                        grid.store.removeAt(インデックス);
                        grid.store.insert(インデックス+ 1、レコード)
                        。grid.getSelectionModel()を選択し(インデックス+ 1)。

                    }
                }
            })。
        }他{
            Ext.Msg.alert( '提示'、 '请选择要移动的行!')。
        }
    }
    //置顶
    onTopclick:関数(){
        私VAR =この、
            参考文献の=のme.getReferences()、
            グリッド=参考文献[ "CirculationDeptGridForm"]、
            店舗= Ext.StoreManager.get( 'usersource店舗')、
            rowSelectionModel = grid.getSelectionModel()。
        IF(rowSelectionModel.hasSelection()){
            VARレコード= rowSelectionModel.getSelected()GetAt機能(0)。
            store.load({
                paramsは:{
                    DEPTID:record.data.deptname
                }、
                コールバック:関数(レコード、オプション、成功){
                    VAR指数= grid.store.indexOf(レコード);
                    IF(指数> 0){
                        grid.store.removeAt(インデックス);
                        グリッド。 store.insert(0、レコード);
                        grid.getSelectionModel()SELECT(0);.
                    }
                }
            });
        }他{
            Ext.Msg.alert( 'プロンプト'、「移動する行を選択してください「);!
        }
    }
    //終了設定
    関数(){:onBottomclick
        VAR =ミーこれを、
            参考文献= me.getReferences()、
            グリッド=参考文献[ "CirculationDeptGridForm"]、
            店舗= Ext.StoreManager.get( 'usersource店舗')、
            rowSelectionModel = grid.getSelectionModel()。
        IF(rowSelectionModel.hasSelection()){
            VARレコード= rowSelectionModel.getSelected()GetAt機能(0)。
            store.load({
                paramsは:{
                    DEPTID:record.data.deptname
                }、
                コールバック:関数(レコード、オプション、成功){
                    VAR指数= grid.store.indexOf(レコード);
                    IF(指数<grid.store.getCount( ) - 1){
                        grid.store.removeAt(インデックス);
                        grid.store.insert(grid.store.getCount()、レコード);
                        grid.getSelectionModel()を選択し(grid.store.getCount() - 1);.
                    }
                }
            })。
        他{}
            Ext.Msg.alert( 'プロンプト'、「移動する行を選択してください「!);
        }
    }、

おすすめ

転載: blog.csdn.net/qq_20426717/article/details/89175001