• Resolved pfm

    (@pfm)


    Dear Tobias,

    I read the FAQ’s the documentation and the forum blogs. I have to say I’m a real beginner using CSS so it might be an easy one.

    My table: https://fosm.de/destillerien/

    Columns 2 and 4 do have numbers in it. Both should be aligned right. As far as I understood I do have to add custom CSS. I did so (using the german version) in Einstellungen->Zusatz-CSS as follows:

    .wp-table-reloaded-id-1 .column-2 {
    	text-align: right;
    }
    
    .wp-table-reloaded-id-1 .column-4 {
    	text-align: right;
    }

    This seems not to affect the alignment at all. Did I miss something or is my CSS wrong?

    Furthermore it would be great to have the numbers in column-4 shown as formatted
    1.200.000 (instead of 1200000). Is this possible with CSS or where do I have to adjust this?

    Thank you very much for your help. Great Plugin!

    BR
    Peter

    https://www.ads-software.com/plugins/wp-table-reloaded/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi Peter,

    thanks for your post, and sorry for the trouble.

    The reason for why this code is not working is that you are already using TablePress instead of the old WP-Table Reloaded (which is a good thing). Because of that, the CSS code also has to be adjusted to the needs of TablePress, and it can be shortened a little bit:

    .tablepress-id-1 .column-2,
    .tablepress-id-1 .column-4 {
    	text-align: right;
    }

    Changing the number format (so that they have the . as a thousand separator) is not possible with CSS, unfortunately. You will have to add those directly in the table data. You will then however notice that the sorting does no longer work properly for that column, as the . is interpreted like a comma (decimal separator). To fix that again, you’ll then need to use this TablePress Extension: https://tablepress.org/extensions/datatables-sorting-plugins/

    Regards,
    Tobias

    Thread Starter pfm

    (@pfm)

    Hi Tobias,

    thank you for the quick help. CSS works now.
    As I use Excel for the import data I can adjust my formats in Excel. I’ll use the plugin Extension for the sort order then. Great!

    Best regards
    Peter

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped!

    Best wishes,
    Tobias

    Thread Starter pfm

    (@pfm)

    Hi Tobias,

    I did download and install the plugin datatables-sorting-plugins

    I entered the code (in additional commands):

    "aoColumnDefs": [ { "sType": "numeric-comma", "aTargets": [ 3 ] } ]

    As the 4th column “KAPAZITAET” = Col D is the one with numbers formatted like this:

    12.000.000 (means 12 Mill.). There is no “,” and no decimal digits.

    The sort order is the same as not entered the special code. There are “some” of the rows sorted wrong.

    Here is the Table

    Have I misunderstood the “how to” or is there something wrong? I did not find more documentation on the plugin but as my “problem” was there as a guideline I thought I got it…

    Thank you for your help!

    Best regards
    Peter

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi Peter,

    I’m not exactly sure, but it’s likely that the - entries in that column cause trouble here. All cells in that column will need a real numeric value. Can you maybe try that?

    Regards,
    Tobias

    Thread Starter pfm

    (@pfm)

    Hi Tobias,

    must be something else. I did replace the “-” with 0 and reimport. If you double click (for descending) you see the problem. It then starts with 780.000 going down to 20.000. The next entry is the biggest one: 13.000.000

    I can get rid of the “.” but then it does not read so good anymore. But sorting especially for this column is essential. Any other idea what I made wrong?

    Thank you.

    Best regards
    Peter

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi Peter,

    ah, that’s unfortunate.
    I’ll have a look at the “numeric-comma” sorting algorithm in detail tomorrow. It might be possible that it actually only deals with the , as a decimal separator, but that it doesn’t also take care of the thousand separators. I’ll post here again as soon as I find something!

    Regards,
    Tobias

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    I might have found a quick and easy solution. Please re-install the Sorting Plugins Extension again from https://tablepress.org/extensions/datatables-sorting-plugins/ and re-apply the “Custom Command” with the “numeric-comma” algorithm. That should now also sort your numbers without problems, even with the “-” which will be treated as 0.

    Regards,
    Tobias

    Thread Starter pfm

    (@pfm)

    Hi Tobias,

    GREAT!! It works! Thank you for the quick help. You created great plugin with superb Extensions!

    Best regards
    Peter

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped!

    Best wishes,
    Tobias

    Hallo, Tbias! How i can vary size my tables. I want relative width. How can I do it?

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    I will reply in the thread at https://www.ads-software.com/support/topic/change-table-width-1 where you also asked.

    Regards,
    Tobias

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Columns with number / Format and align’ is closed to new replies.