Update a Repeater after inserting a new row in the Table?

2

Good morning, guys!

I have a table that is populated with a Repeater. This table has a filter, which is programmed all via javascript from a ready layout. After adding a new value in the table and using its filter, only the initial values appear when the table was loaded.

Table structure:

<div id="divtabela" class="col-md-12 col-sm-12 col-xs-12 table-responsive table-red filter-right">
              <table id="tabelaprodutos" class="table table-striped table-hover table-dynamic">
               <thead>
                  <tr>
                     <th>Descrição</th>
                     <th>Item</th>
                   </tr>
                </thead>
                <tbody>
                    <asp:Repeater runat="server" ID="rptProdutos">
                         <ItemTemplate>
                              <tr>
                                 <td style='vertical-align: middle;'><%# rptPostNome(Container) %></td>
                                 <td style='vertical-align: middle;width:25%'><%# rptPostAtivo(Container) %></td>  
                             </tr>
                         </ItemTemplate>
                   </asp:Repeater>
                 </tbody>
              </table>
    </div>

I add a value to this table via Ajax (I also add in the database, on the same request):

$.ajax({
         type: "POST",
         url: "novoDispositivo.aspx/testeajax",
         data: '{produto: ' + JSON.stringify(produto) + '}',
         contentType: "application/json; charset=utf-8",
         dataType: "json",
         success: function (response) {

                        if (response.d != "") {

                        var quebra = response.d.split('~~');

                        $("#tabelaprodutos")
                        .prepend(
                            "<tr role='row'><td style='vertical-align: middle;'>"
                              + quebra[0] +
                            "</td><td style='vertical-align: middle;'>"
                              + quebra[1] +
                            "</td><td style='text-align:right; padding-right:50px'>"  
                              + quebra[2] +
                            "</td></tr>" 
                         );

So far everything works perfectly, adds in the database and populates the table.

It happens that when I use the Filter, it adds up with the new values added in the table. And it only reappears when I give a postback, refresh the page or the like.

Is there any way I can update my Repeater data without postback? So, when I use the filter it recognizes these new added values?

Thank you in advance!

    
asked by anonymous 17.05.2016 / 15:04

0 answers