Click here to Skip to main content
16,020,188 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys

I currently am using a Bootsrap datatable to display data which is returned from my view in my MVC application.

I currently have a column in the datatable which shows the source of the row of the data as well as the Key which is brought back from the source.

The Key column is a hyperlink currently, i would like to update the datatable to cater for 2 more key fields so basically the columns are (source,key), i would like to update the columns to be (source,key,key1,key2),

I have updated my model and now am able to show the data in the datatable for key1 and key2, the issue i am having is i am not too sure how to check if the column key is null then make the key1 a hyperlink and if key1 is null make key2 a hyperlink.

What I have tried:

currently this is the javascript i am using to add the hyperlink

{
                     "mData": "key",
                     "mRender": function (data, type, full) {
                         
                         var url = (full.System == 'System1') ? full.System1 : full.key;
                         url = full.System + '/' + url;
                         var name = (full.key == null) ? "New record" : full.key

                         return '<a href="/Supplier/Edit/' + url + '">' + name + '</a>';
                     }
                 },
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900