Okay
  Public Ticket #2885025
Display Selected Row Data in another section
Closed

Comments

  • Gnaroum started the conversation

    Hi team, 

    I would like to create a dynamique display. In the front end, when the user clicks on a raw, I would Like to display the column 2 of that raw in another text field. Have can I get that value using query?

    Do you have an example? 


    Thank you in advance.

    Gna

  • [deleted] replied

    Hi Gna

    Thank you for reaching out to us.

    If I understand correctly you want an entry from the table as a hyperlink that would take the visitor to the specific post or page? That link would be dynamically generated by the content of the cell, right? 

    If that's true, you could use the CONCAT function, like this: 

    SELECT column1,column2,       
    CONCAT('<a href="www.yourwebsite.com/page1/',yourTable.column3,'">',yourtable.column3,'</a>') 
    AS HyperlinkFROM yourTable 

    This will create a hyperlink to www.yourwebsite.com/page1/value1 if there's "value1" entered as cell data in column3. On another row, it could be www.yourwebsite.com/page1/value2 if there's "value2" in the cell, and so on. So, this would be a hyperlink which could be shown in the modal, and it would take the user to the respective page.

    I hope this helps, do let us know if you need any further assistance.

  • Gnaroum replied

    Thank you for you answers.  

    Actually what I want,  is to display the column 3 content in a textarea when the user clicks on the row. 

    onRowclick -->> Display Column 3 content in  TextArea. 

  • Gnaroum replied

    Something like this 

     jQuery("#table_1").on('click', 't > a',function() { 
       var row = $('#table_1 tr.selected').get(2);       
        document.getElementById("myTestareaid").innerHTML = row;        
        alert(link);    
        }); 


  • Gnaroum replied

    HI team, found the solution: 

    jQuery(document).ready(function() {

        jQuery("#table_1").on('click', 'tr', function() {
            var entryrules = jQuery(this).closest("tr").find('td:eq(2)').text();
            var exitrules = jQuery(this).closest("tr").find('td:eq(3)').text();
            document.getElementById("txtEntryRules").innerHTML = entryrules;
            document.getElementById("txtExitrulesId").innerHTML = exitrules;
            //alert(exitrules);
        });

    });


  • [deleted] replied

    Hi Gna

    Firstly I want to apologize for the late reply I was out of the office.

    I am glad to hear you found the solution once again I'm sorry I wasn't able to help in the meantime.

    Do let us know if there is anything else we can assist you with.

    Have a wonderful day!