开发者

jqgrid dynamic form change label in formedit/add

i have a form ....

{
    width:450,height:350, //1
    beforeShowForm: function(formID) {     
        recreateForm: true,
        alert("Really?") ; 
        jQuery('#tr_b_date',  formID).show();
        jQuery('#tr_buchung', formID).show();  

        jQuery('#tr_b_menge_lsv',  formID).hide();
        jQuery('#tr_b_text_lsv',   formID).hide(); 
        jQuery('#tr_b_summe_lsv',  formID).hide(); 
        jQuery('#tr_b_menge_cvvp', formID).hide();
        jQuery('#tr_b_text_cvvp',  formID).hide(); 
        jQuery('#tr_b_summe_cvvp', formID).hide();  

        jQuery('#buchung', formID).change(function() { 

            var index = $(this)[0].selectedIndex;
            if (index == 1) {
                jQuery("#kundenbuchung").setColProp('LSV',
                                                    {formoptions:{label:'TEST1'}});
                jQuery("#kundenbuchung").setColProp('Count_L',
                                                    {formoptions:{label:'TEST2'}});
                jQuery('#tr_b_summe_lsv', formID).show();     
                jQuery('#tr_b_text_lsv',  formID).show(); 
                jQuery('#tr_b_menge_lsv',  formID).hide(); 
                jQuery('#tr_b_menge_cvvp', formID).hide(); 
                jQuery('#tr_b_text_cvvp',  formID).hide(); 
                jQuery('#tr_b_summe_cvvp', formID).hide();
            } 
            else if (index == 2) { .....`

I want to change the labels in the form dynamicly, but

jQuery("#kundenbuchung").setColProp('LSV',    {formoptions: { label: 'TEST1' }} );
jQuery("#kundenbuchung").setColProp('Co开发者_如何转开发unt_L',{formoptions: { label: 'TEST2' }} );

doesn't work. Any Ideas?

Schalotte


Inside of beforeShowForm the form is already created. You can tried to change label inside of beforeInitData.

Another way is to change

jQuery("#kundenbuchung").setColProp('LSV', {formoptions: {label:'TEST1'}})

to

jQuery('tr#tr_LSV > td.CaptionTD', formID[0]).html('TEST1')

or something about this. I recommend you to use recreateForm:true option to be sure that beforeShowForm will be called at every row editing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜