Rumah > hujung hadapan web > tutorial js > Perbincangan ringkas tentang kaedah menyunting treegrid dalam EasyUI_jquery

Perbincangan ringkas tentang kaedah menyunting treegrid dalam EasyUI_jquery

WBOY
Lepaskan: 2016-05-16 16:11:57
asal
1115 orang telah melayarinya

Jadual tuan-hamba, jadual hamba ialah grid pepohon Selepas memuatkan data, klik pada nod untuk memasuki keadaan penyuntingan.

Salin kod Kod adalah seperti berikut:

lajur : [ [ {
            tajuk : "ID",
            medan : "id",
            tersembunyi : benar
        }, {
            medan : "pid",
            tersembunyi : benar
        },  {
            tajuk : "AAA",
            medan : "aaa",
            lebar : 70,
            selaraskan : "tengah",
            halign : "tengah"
        }, {
            tajuk : "BBB",
            medan : "bbb",
            lebar : 70,
            selaraskan : "tengah",
            halign : "tengah",
            editor : {
                taip : "combobox",
                pilihan : {
                    data : [ {
                        "id" : 0,
                        "teks" : "苹果"
                    }, {
                        "id" : 1,
                        "teks" : "梨子"
                    } ],
                    valueField : 'id',
                    textField : 'teks',
                    boleh disunting : palsu,
                    // diperlukan : benar,
                    panelHeight : "auto",
                    missingMessage : "请选择水果",
                    onSelect : function(rekod) {
                        //editingId是进入编辑状态行的id
                        var editors = $('#grid').datagrid('getEditors', $('#editingId').val());
                        if(record.id == 1){//选择梨子
                            var feditor = editor[1];//一行中第二个编辑框
                            //将编辑框设置成必填
$(feditor.target).validatebox({required:true});
//Tetapkan kotak edit kepada boleh diedit
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          var feditor2 = editor[2];//Kotak edit ketiga dalam satu baris
$(feditor2.target).validatebox({required:true});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   }lain jika(record.id == 0){//Pilih Apple
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   $(feditor.target).validatebox({required:false});
$(feditor.target).validatebox("setValue","");
                                                                                                                                                                                                                                                                                                                                                             ... $(feditor2.target).validatebox({required:false});
$(feditor2.target).validatebox("setValue","");
                                                                                                                                                                              },
                }
            }
}



Dayakan status pengeditan

Salin kod

Di atas adalah kaedah menyunting treegrid dalam EasyUI saya harap anda akan menyukainya.
Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan