Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery Uniform Update doesn't work

I'm using jquery uniform on one of the project I'm working on. Since this is admin panel, I truly don't have option to show. I will explain my problem

What I'm trying to do is quite simple. I'm adding some form elements (like select, check box, text input) to the page with ajax.

Every single thing works except re-styling those dynamically added form elements.

function step2 () {
    $.post( siteUrl + "includes/ajax/members/add-subscription.php?do=step2", $("#selectedSubscribers").serialize(), function( data ) { 
        $('.step2_content').html(data);
        $.uniform.update(); 
    });
 }

Anyone experienced similar problem? Even my onClick, onChange functions are working without a problem (dynamically added form elements), it is just, $.uniform.update(); doesn't seem to work.

I thought processing data could take longer time so $.uniform.update(); is called before data is processed so I tried $.ajax with async: false with no luck.

I will be glad if anyone who experienced such problem or who knows the solution could help me out with this problem.

Thank you in advance.

like image 701
Revenant Avatar asked Oct 23 '11 18:10

Revenant


3 Answers

When $.uniform() is first called, it collects all the specified elements into an internal array of affected elements. When you call $.uniform.update() it simply restyles those elements that were already collected.

To add additional elements, you may need to call $.uniform() again, passing a selector identifying only those new, dynamically added elements.

like image 151
Sean Carpenter Avatar answered Oct 23 '22 22:10

Sean Carpenter


for load() if fix promblem

$('#dialog').load(url + ' #forload', function() {$('#dialog').find('select').uniform(), $('#dialog').find('input:checkbox').uniform()})
like image 5
dpolyakov Avatar answered Oct 23 '22 22:10

dpolyakov


Have you tried this?

$.uniform.update("#select_element_id");

In my case, the problem was solved.

Being old the version of uniform, may cause your problem.

like image 2
hotohoto Avatar answered Oct 23 '22 23:10

hotohoto