• Resolved axbx

    (@axbx)


    Hi !
    In my tablepress, i’d like to add in cell B1, an incrementing button wich add 1 at the A1 cell value.

    In B1 cell, I wrote this in Avanced Editor :

    <button onclick=”increment()”>+</button>

    <script>
    var data = 0;

    function increment() {
    data = data + 1;
    document.getElementById(“[table-cell id=6 cell=A1 /]”).innerText = data;
    }
    </script>
    Something is wrong, because A1 doesn’t change :). Is it the celle A1 id ?
    Could somebody help me please ?
    Sorry for my bad English and my bad code also !
    Bets regards

    The page I need help with: [log in to see the link]

Viewing 14 replies - 16 through 29 (of 29 total)
  • Thread Starter axbx

    (@axbx)

    ok, I understand.

    I think it’s good 🙂 🙂
    I was afraid of JavaScript code, because, I’m not expert !, but it works ! I’m lucky, my formulas are very simple.

    Thanks a lot for your help.
    Best regards

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    yes, you shouldn’t really need complicated math formulas, just a bit of sums and multiplication 🙂

    Best wishes,
    Tobias

    Thread Starter axbx

    (@axbx)

    Hi,
    I have 2 types of tables in my site, on type is “A”, the other is “B”.
    All the “A” tables have the same css properties.
    All the “B” have others css properties but all are the same.

    I know that I can change a table-Id. So I can decide that all my “A” tables have odd-Id, and all the “B” have even-id.

    Is it possible to have something like that :

    .tablepress.odd-id td {
    color etc}
    and .tablepress.even-id td {
    background etc}

    Or do I have to enter .tablepress-id-3 {}, and.tablepress-id-4 {}..and tablepress-id-52 :), so one .tablepress-id for each table ?
    Many thanks.
    Regards

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    that specific approach will not directly work (because CSS can’t decide about odd/even of an ID). Instead, you should use “Extra CSS classes” for this.

    Please see https://ww.wp.xz.cn/support/topic/interval-of-tables/ and https://ww.wp.xz.cn/support/topic/creating-a-class-for-multiple-tables/#post-12569808 for some examples.

    In your case, you could use e.g. tablepress-category-a and tablepress-category-b (or similar) in the “Extra CSS classes” field on the table’s “Edit” screen, and then CSS like

    .tablepress-category-a td {
      color: ...
    }
    .tablepress-category-b td {
      background: ...
    }

    Regards,
    Tobias

    Thread Starter axbx

    (@axbx)

    Ah super !

    It’ just I wanted to do ! Sorry, I read many supports but I did’nt find that.

    Thanks a lot, really !

    Have a nice we
    Best regards

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    no problem 🙂

    Best wishes,
    Tobias

    Thread Starter axbx

    (@axbx)

    Hi,
    Me again, sorry !

    I can’t solve my problem :
    In my table I must have all the text-align: center.
    But, in a row, it’s look like that :
    tomates
    fraiches ou 1
    boite
    I try to have : (center horizontal in the cell)
    tomates
    fraiches ou 1
    boite

    I tried text-align: left; padding-left:auto;padding-right:auto; doesn’t work in my table class
    I tried in the cell <div class=”truc”>tomates etc</div> with .truc {text-align: left} , while tableclass table is with {text-align:center}, expecting it will center the div. But doesn’t work
    I tried many else, and never work !
    Would you have an idea ?
    Thanks a lot !
    Best regards

    Thread Starter axbx

    (@axbx)

    oh !! I see that you can see my problem !
    in the frist case, the 3 words are each center in the lign.
    And I’d like them to be align left, and all the group in the center of cell.
    Very very difficult to communicate when screen doesn’t respect tabulations 🙂
    Regards

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    Can you please post a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!

    Regards,
    Tobias

    Thread Starter axbx

    (@axbx)

    Hi,
    thanks for your answer
    https://saucegrimich.bouchure.com/crevettes-au-gingembre/

    (And, test my buttoms + and -, you see they modify the “crevettes cuites” quantity.
    🙂 🙂 with your advises !)
    Regards

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for the link! To make this left aligned, please add this to the “Custom CSS” textarea on the “Plugin Options” screen of TablePress:

    .tablepress tbody td .textingr {
      text-align: left;
    }

    Regards,
    Tobias

    Thread Starter axbx

    (@axbx)

    Hi,
    it’s better ! but cells with a long text are text-align left, not center. So I add a little padding-left and it looks perfect.

    I thank you very much !
    Have a good day,
    best regards

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    sounds good! 🙂

    Best wishes,
    Tobias

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    and here it is, the first beta of TablePress 2.0 is ready for testing, if you are still looking for text support in Excel formulas: https://tablepress.org/8-million-downloads-tablepress-2-0/

    Best wishes,
    Tobias

Viewing 14 replies - 16 through 29 (of 29 total)

The topic ‘button onclick=”increment”’ is closed to new replies.