link to detailed page

link to detailed page

PhoffmanPhoffman Posts: 4Questions: 2Answers: 0
edited August 12 in Free community support

Hello,
I am stucked on creating a column with link to a detailed page. The link should be passing current row id, something like: <a href="details&id=??">...
an option would be also a button that takes the user to the detailed page, I have purchased the editor, if it helps somehow.
My last try was using render option. But instead of the link I have received a "safe" string.
columns: [
{
data: "id",
render: function ( data, type, row ) {return '<a href="editproduct&id='+data+'">'+data+'</a>';
}
},
I expect the text was modified by my php framework.
I am not writing the js function, I am generating it in the view from objects created in my controller, that is why I think the php framework is changing the html tags to strange characters...
Do you have some tips how to achieve what I need for example using a button and defining the target somehow (i did not find this possibility)?

Thank you.

Answers

  • kthorngrenkthorngren Posts: 1,668Questions: 18Answers: 352

    Seems like your code should work.

    Maybe something like this for a button:

                 render: function (data, type, row ) {
                   return '<form method="GET" action="editproduct&id=' + data +'">' + 
                          '<input type="submit" value="' + data + '">' + 
                          '</form>';
                 }
    

    Kevin

  • PhoffmanPhoffman Posts: 4Questions: 2Answers: 0

    Thank you for the tip. For sure I will use it.

    My problem is that I can not pass the complete HTML to the view as the content is by security of the framework escaped.
    But the solution is easy. Just pass the action parameter and the text to show and the HTML tags generate directly inside of the view. This is what I did not realize yesterday that is possible to do.
    Good point that the link can be a button as well. Thank you.

Sign In or Register to comment.