Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot apply prettyCheckable to elements loaded via ajax call #87

Open
dcalmbach opened this issue Aug 4, 2014 · 2 comments
Open

cannot apply prettyCheckable to elements loaded via ajax call #87

dcalmbach opened this issue Aug 4, 2014 · 2 comments

Comments

@dcalmbach
Copy link

Hi,
first of all many thanks for your great looking plugin.

Now my problem:

I load a document with several table rows like this

<tr id="tr4545" class="odd">
    <td><input type="hidden" name="_bekannt" /><input
        type="checkbox" name="bekannt" checked="checked" value="85"
        onChange="cbClick(event, this,4545);" id="bekannt" /></td>
    <td style="text-align: right">1</td>
    <td style="text-align: right"></td>
    <td>Also hat Gott die Welt geliebt</td>
</tr>

In the document.ready section i apply checkable like this:

$(":checkbox").each( function(){ $(this).prettyCheckable()})

and everything works fine.

When the checkbox is clicked, the table row is reloaded via ajax:

function check(liedId) {
    var rowId = "#tr" + liedId;
    $(rowId).load("/lied/lied/check", {
        id : liedId
    }, new function() {
        formatRowElements(rowId);   
});

on ajax completion i try the apply prettyCheckable the the new row:

function formatRowElements(rowId) {
    $(rowId + " select").addClass( "ui-corner-all ui-state-default");
    console.log($(rowId + " :checkbox"));
    $(rowId + " :checkbox").prettyCheckable();
}

But this does not work. I checked the log, the selector is working and shows the row.

Pls help.

@fenos
Copy link

fenos commented Sep 29, 2014

yes same problem

@arthurgouveia
Copy link
Owner

Um... very weird. Can you please provide a working example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants