How to make jquery click work with Infinite Scroll?

Asked

Viewed 29 times

0

I have the homepage with a list of things:

<table id="table" class="tabela" >
    <thead>
        <tr>
            <th class="check">V</th>
            <th class="nivel">N</th>
            <th class="item">Item</th>
            <th class="item2">item2</th>
            <th class="item3">item3</th>
            <th class="item4">item4</th>
            <th class="item5">item5</th>
            <th class="item6">item6</th>
            <th class="icone">PT</th>
            <th class="icone">IT</th>
            <th class="icone">JT</th>
            <th class="icone">DXF</th>
            <th class="icone">RAR</th>
            <th class="icone">ZIP</th>
            <th class="icone">EPJ</th>
            <th class="formulario">Form.</th>
            <th class="comentario">C.</th>
            <th class="endereco">Endereço</th>
            <th class="data">Data</th>
        </tr>
    </thead>
    <tbody>
    <?php
    include 'banco_configuracao/config.php';
    $rowperpage = 100;
    $sql = "select * from LISTA2  order by cast(REFERENCIAGERAL as int) offset 0 rows fetch next $rowperpage rows only ";
    $result = sqlsrv_query($conn, $sql);
    while ($row = sqlsrv_fetch_array($result)) { ?>            
        <tr style = "background-color: <?php echo $row["CORDEFUNDO"]?>; color: <?php echo $row["CORDETEXTO"]?>">
            <td class = "check" id = "<?php echo $row["REFERENCIAGERAL"]?>">
                <input onclick = "passaValor(this.id)" class = "largerCHECKBOX" type = "CHECKBOX" id = "<?php echo $row["REFERENCIAGERAL"]?>" <?php echo $row["CHECKBOX"] ?> name="">
            </td>                
            <td class="nivel" style="visibility: <?php echo $visibilidade_nivel ?>"><?php echo $row["FORMATACAO"]; if ($row['NIVEL'] != NULL) {echo $row['NIVEL'];} else {echo 'vazio';} echo $fecha_formatacao; ?></td>
            <td class="item" style="visibility: <?php echo $visibilidade_item ?>"><?php echo $row["FORMATACAO"]; if ($row["NUMERO_ITEM"] != NULL) {echo $row['REFERENCIAGERAL'];} else {echo 'vazio';} echo $fecha_formatacao; ?></td>
            <td class="material"><?php echo $row["FORMATACAO"];echo $row['MATERIAL']; echo $fecha_formatacao; ?></td>
            <td class="descricao"><?php echo $row["FORMATACAO"]; echo utf8_encode($row['DESCRICAO']); echo $fecha_formatacao; ?></td>
            <td class="qtd_eng"><?php echo $row["FORMATACAO"]; echo $row['QTDENG']; echo $fecha_formatacao; ?></td><td class="qtd_falt"><?php echo $row["FORMATACAO"]; echo $row['QTDFALT']; echo $fecha_formatacao; ?></td>
            <?php
            if ($row["OBSERVACAO"] != ' ') {
                $visibilidade = "visible";
            } else {
                $visibilidade = "hidden";
            }?>

            <td class="obs" style="visibility: <?php echo $visibilidade ?>"><?php echo $row["FORMATACAO"];if ($row["OBSERVACAO"] != ' ') { echo utf8_encode($row['OBSERVACAO']); } else {echo "hey";} echo $fecha_formatacao; ?></td>
            <td class="icone" id="<?php echo $row["PDF_PT"] ?>" style="visibility: <?php echo $visibilidade_pdf ?>"><img src="<?php if ($row["LINK_TCD_LINK_PDF_PT_IMAGE"] != NULL) { echo $row["LINK_TCD_LINK_PDF_PT_IMAGE"]; } else {echo 'icones/pdfbr.png';} ?>" width="30"></td>
            <td class="icone" style="visibility: <?php echo $visibilidade_it ?>">
                <a href="<?php echo $row["PDF_IT"] ?>" target="_blank"><img src="<?php if ($row["LINK_TCD_LINK_PDF_IT_IMAGE"] != NULL) {echo $row["LINK_TCD_LINK_PDF_IT_IMAGE"];} else {echo 'icones/pdfit.png';} ?>" width="30"></a>
            </td>
            <td class="icone" style="visibility: <?php echo $visibilidade_jt ?>">
                <a href="<?php echo $row["LINK_JT"] ?>"target="_blank"><img src="<?php if ($row["LINK_TCD_LINK_JT_IMAGE"] != NULL) {echo $row["LINK_TCD_LINK_JT_IMAGE"];} else {echo 'icones/linkjt.png';} ?>" width="30"></a>
            </td>
            <td class="icone" style="visibility: <?php echo $visibilidade_dxf ?>">
                <a href="<?php echo $row["LINK_DXF"] ?>"target="_blank"><img src="<?php if ($row["LINK_TCD_LINK_DXF_IMAGE"] != NULL) {echo $row["LINK_TCD_LINK_DXF_IMAGE"];} else {echo 'icones/dxf.png';} ?>" width="30"></a>
            </td>
            <td class="icone" style="visibility: <?php echo $visibilidade_rar ?>">
                <a href="<?php echo $row["LINK_RAR"] ?>"target="_blank"><img src="<?php if ($row["LINK_TCD_LINK_RAR_IMAGE"] != NULL) {echo $row["LINK_TCD_LINK_RAR_IMAGE"];} else {echo 'icones/rar.png';} ?>" width="30"></a>
            </td>
            <td class="icone" style="visibility: <?php echo $visibilidade_zip ?>">
                <a href="<?php echo $row["LINK_ZIP"] ?>"target="_blank"><img src="<?php if ($row["LINK_TCD_LINK_ZIP_IMAGE"] != NULL) {echo $row["LINK_TCD_LINK_ZIP_IMAGE"];} else {echo 'icones/zip.png';} ?>" width="30"></a>
            </td>
            <td class="icone" style="visibility: <?php echo $visibilidade_epj ?>">
                <a href="<?php echo $row["LINK_EPJ"] ?>"target="_blank"><img src="<?php if ($row["LINK_TCD_LINK_EPJ_IMAGE"] != NULL) {echo $row["LINK_TCD_LINK_EPJ_IMAGE"];} else {echo 'icones/epj.png';} ?>" width="30"></a>
            </td>
            <td class="formulario" id="<?php echo $row["REFERENCIAGERAL"] ?>">
                <input type="image" title="Formulários" id="<?php echo $row["REFERENCIAGERAL"] ?>" src="imagens/forms.png" name="" width="30" >
            </td>
            <td class="comentario" style="visibility: <?php echo $visibilidade_comentario ?>"><img src="icones/comentario.png" width="30" id="<?php echo $row["REFERENCIAGERAL"] ?>"></td>
            <td class="endereco" style="visibility: <?php echo $visibilidade_endereco ?>"><?php echo $row["FORMATACAO"];if ($row['ENDERECO_ENTREGA'] != NULL) {echo $row['ENDERECO_ENTREGA'];} else {echo 'hey';} echo $fecha_formatacao; ?></td>
            <td class="data" style="visibility: <?php echo $visibilidade_data ?>"><?php echo $row["FORMATACAO"]; echo $row['PRODUCAOPCP_DATA_DE_REMESSA'];echo $fecha_formatacao; ?></td>
    </tr>
<?php } ?>
    </tbody>
</table>

I have a jquery that loads the next page. The infinite scroll works perfectly. However when clicking on the td with jquery I open a modal with the id of the clicked item and this does not work when I am on the other php page. The other php page contains the continuation of the list, it is it that loads the other data. When the first 100 items come to an end one more page is loaded;

1 answer

0

Use the . on method();

$('div').on('click', function()
{
    //evento
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.