JqTransform Update Select Options

I am dynamically changing the options of the selection list. I am using jqTransform plugin. It will not automatically update automatically, which I did not expect, but I can find a way to update the display. I can’t even find a way to completely remove it.

I would like to find a method like formelement.jqTransformUpdate () that will fix this. Any ideas?

+5
source share
5 answers

I know this is an old question, but maybe it helps someone. I could not find the answer, so I looked at the jqtransform.js code.

Just comment on this line:

if($select.hasClass('jqTransformHidden')) {return;}

And then, after the "onchange" event is fired:

$('#container select').jqTransSelect();
+3
function selectRating(rating) {
   $("#ratingModal .jqTransformSelectWrapper ul li a").each(function() {
     if (parseInt($(this).attr("index")) == rating - 1) {
         $(this).click();
     }
   });      
}

JS, , . , , .

, a.click .

+1

, , , , ajax

$('# container select'). jqTransSelect();

0

:

,

:

if($select.hasClass('jqTransformHidden')) {return;}

:

if($select.hasClass('jqTransformHidden')) $select.parent().removeClass();

, , select , .

0
source

This might be better, try adding a new method in jqtransform.js:

$.fn.jqTransSelectRefresh = function(){
    return this.each(function(index){
        var $select = $(this);

        var i=$select.parent().find('div,ul').remove().css('zIndex');
        $select.unwrap().removeClass('jqTransformHidden').jqTransSelect();
        $select.parent().css('zIndex', i);

    });
}

after that, just call it every time you need to update the drop-down list:

$('#my_select').jqTransSelectRefresh();
0
source

All Articles