Topic: Accessing data of a selected row in a paginated, editable table

sundance free asked 3 years ago


How to access to data values in a selected row of an editable table?

Given a (paginated) table, filled by pgSql query, e.g.:

    $sql  = "SELECT * FROM uplink_data_message";
    $sql .= ' ORDER BY udm_azon DESC'; 
    $sql .= ' LIMIT 200'; 

    $result = pg_query($sql) or die( pg_last_error());
    $rows = pg_num_rows($result);


      <div class="table-responsive">
      <!-- table-bordered -->
          class="table table-condensed table-striped table-sm text-nowrap" 

              <th>Freq. (MHz)</th>

            while($row = pg_fetch_assoc($result)){
              echo "<td>".$row['udm_azon']."</td>";
              echo "<td>".$row['udm_ts']."</td>";
              echo "<td>".$row['udm_seqno']."</td>";
              echo "<td>".$row['udm_port']."</td>"; // cd_timestamp
              echo "<td>".number_format( (float)$row['udm_freq']/1000000,2,',',' ') . "</td>";
              echo "<td>".$row['udm_rssi']."</td>";
              echo "<td>".$row['udm_snr']."</td>";
              echo "<td>".$row['udm_dr']."</td>";
              echo "<td>". $formatter->format($row['udm_bat']/255) ."</td>";
              echo "\n\t</tr>\n";
            } // while


   // Free resultset        

Expected behavior

Selecting a row, data of selected row passed ("exported") to further usage, e.g. battery charging level (e.g. Bat = 100%) displayed by min-chart, frequency (in this example 868.50) displayed in a separate label, or any other component, etc.

Actual behavior

Resources (screenshots, code snippets etc.)

Resulted screen: enter image description here

Mateusz Korbut staff answered 3 years ago


I hope this Snippet will answer you question.

Best regards.

meierlin free commented 1 year ago

this solution only works for me on the first page of the paginated table (using Modal Editor Table On later pages it doesn't work. Why is that and is there a way to use this nice solution with table editor?

Marcin Luczak staff commented 1 year ago

Hi @meierlin,

This solution only works for the first page because those elements are the only visible and selectable elements in the DOM tree. For next pages you should wrap this solution in a function and call it every time you change the page so it selects current page elements.

Keep coding, Marcin

sundance free answered 3 years ago

Hi Mateusz!

Perfect solution, thanks.

Best regards,


Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.5
  • Device: PC
  • Browser: Chrome
  • OS: Windows 7 Prof. 64-bit
  • Provided sample code: No
  • Provided link: No