Is it possible for files uploaded using the attachment field to be clickable URLs? And if it is possible, can the links just display the file name, rather than the whole URL?
In the table, go to Customize/Custom CSS and paste that code:
Notice that the font color had to include the !important clause to override the color of the text in the button. After you add this, the button in the table will look like this:
I hope this helps!
And i just wanted to point out that you can try wpDataTables before purchasing
on our sandbox Demo sites ( you can find links for the main plugin Demo,
as well as add-on Demos, in my signature),
and there is a 15-day money-back guarantee period,
so if you purchase the plugin, you can safely fully test it out, and if it doesn't fit your needs you can request and receive a refund in that period. ( same goes for all plugins and add-ons)
Thanks for the super quick response. One more question - do the tables add author, and last modified date and time for each entry into the database? Or will that need to be information collected into fields as each entry is added? The team want to be able to pull in information to display below the tables, i.e. [User] - Last updated [Date] at [Time]
For example, you can have one main/master Manual table which will store all the data in the database.
Then, you can check this table's MySQL Table name from the Editing tab in the back-end table settings,
and you will be able to make multiple SQL tables that pulls data from the same "master table",
and any editing you do on all these other SQL tables are going to be stored in the same table in the database,
This will be my example table :
Now, to make a new SQL Table from it,
first, check in Editing Tab/MySQL table name for editing:
in my example, the Manual table name is wp_wpdatatable_39,
so i make a new SQL table that will pull data from it;
and we can choose all columns like :
SELECT * FROM Table_Name
or just specific columns;
we can also have completely different settings/filtering/sorting and limitations for front-end users on each table;
and you can make multiple SQL Query tables that pull the same data from the "main table".
SELECT column_name1,
column_name2,
column_name3
FROM table_name
-
In this example, if i want to limit to only show the "Company" column, and i will leave wdt_ID ( because we got to have row ID) and userid ( if we want userID for limiting rows per currently logged user ID),
when i hide those columns in the end, the front-end user will only see the "company" column.
SELECT wdt_ID,
userid,
company
FROM wp_wpdatatable_39
Later, you can make another SQL Table that will show some other columns, have other filters and so on ( depending on what you need to achieve)...
Then, in the Editor Type, set as "one line edit", and set the predefined editor value as the placeholder %CURRENT_DATETIME% :
And then, if someone tries to add a new row, this column's value will automatically be default as the current date and time :
-
2.
There is also a custom SQL workaround, for SQL tables, if you need a timestamp :
1. Create a column (for example "Updated") in your table
2. In column settings set the type to be "DateTime" (in the "Data" tab), and in the "Editing" tab set the "Editor Input Type" to "none".
3. In the database, run this query:
ALTER TABLE `table_name` CHANGE `updated` `updated` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
Please note that you need to replace 'table_name' with the actual database table name. You can find the database name of the table in the Editing tab above the table, in the "MySQL query name for editing" field.
Hi team,
Is it possible for files uploaded using the attachment field to be clickable URLs? And if it is possible, can the links just display the file name, rather than the whole URL?
Hi Jan,
Yes, this can be possible, there can be multiple ways, it depends what can be easier for your specific use case.
-
For example, if you use the "attachment" as your current Editor input Type for a Column,
a user can upload a file and the cell of our table will save the URL path of that file.
Applicable column types: on the wpDataTables side can be
URL link Column
or an Image Column;
If you use it as an URL Link Column,
you will see options to make it look as a button for example, and you can set what the button label/text will be,
just note that all cells would then have the same button name.
You can download a Video of this behaviour on my example table here :
https://we.tl/t-rJBEmJRVwi
But you have multiple options what you can do to manipulate the data and how it will display in your table cells.
You can also first start by creating a String Column.
Then, set Editor type to attachment.
If you upload a file, such as a PDF or an image,
this cell stores the URL path to that file.
-
Then, if you change it to an URL Link Type column,
all your cells will again have the same hyperlink name - it takes the Header Name as the hyperlink text;
But if you change the Editor Type now from Attachment to One Line String, ( or multi line string),
now it will actually show the full link and as the hyperlink at the same time.
-
If i edit one of my Cells manually to implement a value,
if i wish to have a custom Hyperlink clickable, i can do like this :
And this will render a clickable text as "Check out wpDataTables".
Please check more about rendering rules for URL Link Columns here.
-
And if you wish to try with a String Column,
for them you need to wrap your URL and the hyperlink text with Custom HTML using the HTML anchor Tag.
For example :
will achieve the same result in a cell, with the clickable text "Check out wpDataTables".
You can learn more about making custom HTML a href links here.
And you can download my Video that shows a couple of ways here.
I hope that helps.
For a more advanced automated solution,
if you don't want to manually input what the hyperlink clickable text should be,
we have possibility to use SQL CONCAT function in our SQL Query Based Tables.
For example if you have a Database Table, and if you have a Column that just stores the file name,
while another Column stores an URL to the file,
then you can combine values from two columns in the same cell with that 'concatenate' function.
You can see an example of how we use this in our Plugin here.
-
You can also make Custom Styles if you wish to make your link look like a button :
For example, if you create a URL Link column and set it to appear as a button, you need to add a custom class to it:
Then, visit this website, generate your button, and click on "Get Code":
In the right part of the screen, you'll see the code you need for this button:
Copy the code without the first row and change "myButton" to the custom class you added in step 1, so instead of this:
You would use this:
In the table, go to Customize/Custom CSS and paste that code:
Notice that the font color had to include the !important clause to override the color of the text in the button. After you add this, the button in the table will look like this:
I hope this helps!
And i just wanted to point out that you can try wpDataTables before purchasing
on our sandbox Demo sites ( you can find links for the main plugin Demo,
as well as add-on Demos, in my signature),
and there is a 15-day money-back guarantee period,
so if you purchase the plugin, you can safely fully test it out, and if it doesn't fit your needs you can request and receive a refund in that period. ( same goes for all plugins and add-ons)
Let me know if you have any additional questions.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hi Milos,
Thanks for the super quick response. One more question - do the tables add author, and last modified date and time for each entry into the database? Or will that need to be information collected into fields as each entry is added? The team want to be able to pull in information to display below the tables, i.e. [User] - Last updated [Date] at [Time]
Hi Jan,
You're welcome.
1. When it comes to automatic storing of the "user name" of the user who created, or edited a row,
at the moment we do not have a default/automatic way without us setting it up in a table.
For storing the information about who added a new row,
the easiest option is with our native feature which can store the User ID of the person who adds a new row.
But if you enable this option, this will limit which rows a front-end user can see and edit;
so each user can only see and edit the rows they added.
While on the back end, for Admins, you can enable the Admin to see all rows,
they just can't edit the rows they did not add.
Please check more about this here.
There is a workaround for this though,
For example, you can have one main/master Manual table which will store all the data in the database.
Then, you can check this table's MySQL Table name from the Editing tab in the back-end table settings,
and you will be able to make multiple SQL tables that pulls data from the same "master table",
and any editing you do on all these other SQL tables are going to be stored in the same table in the database,
This will be my example table :
Now, to make a new SQL Table from it,
first, check in Editing Tab/MySQL table name for editing:
in my example, the Manual table name is wp_wpdatatable_39,
so i make a new SQL table that will pull data from it;
and we can choose all columns like :
or just specific columns;
we can also have completely different settings/filtering/sorting and limitations for front-end users on each table;
and you can make multiple SQL Query tables that pull the same data from the "main table".
-
In this example, if i want to limit to only show the "Company" column, and i will leave wdt_ID ( because we got to have row ID) and userid ( if we want userID for limiting rows per currently logged user ID),
when i hide those columns in the end, the front-end user will only see the "company" column.
Later, you can make another SQL Table that will show some other columns, have other filters and so on ( depending on what you need to achieve)...
You can see my Video example here https://watch.screencastify.com/v/jOXrsJ9jaspWG5m3VqZH
2. Or, if you want to store the "username" of the user who added a new row,
you can use our dynamic Placeholders here,
and use for example %CURRENT_USER_LOGIN% .
– this placeholder will be replaced with the currently logged-in username (if the user is logged in).
You can read more about Placeholders here.
-
These methods are only to store the user who made a new row,
but when a row is already created - we do not have a solution at the moment if a user edits another user's row,
that row will still save the 'original user who created it' if that makes sense.
For that, you can only try a custom solution which can not be provided by our Support.
3. For a Time Stamp of editing rows, at the moment we don't have a built-in option.
For example, If you need a simple auto pre-populate for the column Date and Time, to be the current Date Time,
we have this placeholder,
that you can use as a predefined editor value.
-
Here is how you can do it :
Set column type to DateTime;
Then, in the Editor Type, set as "one line edit", and set the predefined editor value as the placeholder %CURRENT_DATETIME% :
And then, if someone tries to add a new row, this column's value will automatically be default as the current date and time :
-
2.
There is also a custom SQL workaround, for SQL tables, if you need a timestamp :
1. Create a column (for example "Updated") in your table
2. In column settings set the type to be "DateTime" (in the "Data" tab), and in the "Editing" tab set the "Editor Input Type" to "none".
3. In the database, run this query:
Please note that you need to replace 'table_name' with the actual database table name. You can find the database name of the table in the Editing tab above the table, in the "MySQL query name for editing" field.
-
Let us know if this was helpful,
Thank you
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hi Miloš,
Thanks for taking the time to give such an extensive reply. I really appreciate it, and this is so helpful!
Jan
Hi Jan,
You're welcome.
My apology that i am getting to this just now.
I am glad that it was helpful,
please don't hesitate to open new tickets for any other questions, we will always do our best to advise.
Thank you.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables