WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: WP-Table Reloaded] How to import a table with links (8 posts)

  1. OtaQ
    Member
    Posted 3 years ago #

    Please help me - I got a table with many lines and rows and I just would like to write Links via OpenOffice and .csv - then import it. And overwrite the table if I got new updates... (before you tell me, I don´t want to use the "add link" option in the frontend, cause the table is really big.

    My Problem: If I write the ta like

    <a href="http://the.link.com">The Link no 1</a>

    I always get a

    <a href=http://the.link.com>The Link no 1</a>

    imported... :(

    ..so please tell me, how can I write the links in openoffice (or Save the file) to get this working???

  2. TobiasBg
    Member
    Posted 3 years ago #

    Hi,

    this is coming from non-stanard CSV files (well, unfortunately there is no real standard...).
    In WP-Table Reloaded, I use the most common notation of "" for quotation marks. That is, because single quotation marks " are already used for escaping cell values that contain quotation marks. (see the 4th example here: http://en.wikipedia.org/wiki/Comma-separated_values#Basic_rules)

    This means: If you write your l`inks as

    <a href=""http://the.link.com"">The Link no 1</a>

    in the CSV file, you will get

    <a href="http://the.link.com">The Link no 1</a>

    in the table.

    I'm not sure how you can change that behavior in OpenOffice, so the best way to get this might be to open the CSV file in a text editor and do a search and replace there, e.g. replace href=" with href="" and "> with "">.

    Best wishes,
    Tobias

  3. OtaQ
    Member
    Posted 3 years ago #

    Thanks, this a idea - you must understand, I got a really big Table - So changing the links by hand in the frontend, is not possible - I will try it with the Editor.

    One question more: The sorting A-Z is of course a problem in the row with the Links, cause if you want to sort really by A-Z, all lines have to Links or else it will sort with "<href"-"Z" ;) - But there could be a possibility to get around this problem - Could you maybe make a possibility in one of your next updates, to ignore the URL while sorting? ;)

  4. TobiasBg
    Member
    Posted 3 years ago #

    Hi,

    which sorting mechanism are you talking about, here? The one on the "Edit" screen or the JavaScript sorting, when viewing the table on a page?

    Regards,
    Tobias

  5. OtaQ
    Member
    Posted 3 years ago #

    Oh sorry, I mean viewing the table on a page.

    And then, you can sort the table by A-Z.

    If you got a Link in the table, it always the first in line, because "<a href..." is of course before "A", "B", and "C" :)

    My problem is, I would like to have some words in the table linked, and some not - but sorting should work for the words normally. Let´s say, I want to sort the real words, and not the code ;)

    EDIT: Btw - You doing a GREAT WORK!!! I thank you very much and your work will a important part of my new website - I´ll definitely donate you something and thank you in the imprint ;)

  6. TobiasBg
    Member
    Posted 3 years ago #

    Hi,

    good news, I believe that this is actually already possible :-) You should only need to tell the DataTables JavaScript library (which performs the sorting) to use the values of included HTML (and not the entire HTML string).

    Please try this: Go the "Edit" screen of your table and look for the "Custom Commands" textfield in the "DataTables JavaScript Features" section. There, enter this code:

    "aoColumnDefs": [ { "sType": "html", "aTargets": [ 0 ] } ]

    Just one small change is required: Replace the 0 with the index of the column that you have your links in, minus 1.
    So, if all your links are in (for example) the third column, you would replace the 0 with a 2 (it is a zero based column index).

    This should tell DataTables to sort that column as "HTML", which should exactly be what you would like to have.

    And thanks for your nice words :-) That's great to hear!

    Best wishes,
    Tobias

  7. OtaQ
    Member
    Posted 3 years ago #

    Wow! Thank you so much... :D

  8. TobiasBg
    Member
    Posted 3 years ago #

    Hi,

    no problem, you are very welcome!

    Best wishes,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Topic