A few small questions.

A few small questions.

dredgydredgy Posts: 16Questions: 5Answers: 0

Hi all, I’ve started using DataTables and absolutely love it, so good work. I’m using it as the front end to a kiosk-based Point of Sale system for use in my bar, so a bit of a unique project for me.

I have a few small questions - they’re not high priority for me and I assume I’ll be able to figure them all out in time as the API is pretty intuitive, but thought I’d ask them here to make life a bit easier.

So I have a table that is a readout for all of the items on the current order (before the order has been submitted). Basically when the user presses a button, a new item is added to the order. The table has three columns:

Qty | Item Name | Price

  1. At the moment when a user presses a button, a new row is simply added. I’d like to add accumulation, so that if there is already one item on the list and the user puts through a second unit of the same item, I can check for an existing one and simply update the qty column, best way to do that?

  2. What’s the best way to style the selected row? I haven’t bothered digging through all the CSS, but I want to change the background colour of a selected row.

Thank you!

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    For selected rows, it would be worth looking at the Select extension .

    When you say 'a new row is simply added', is this to a back-end server? Are you using Editor? Or is this all client-side?

    Colin

  • dredgydredgy Posts: 16Questions: 5Answers: 0

    Thank you :)

    It’s all client side, no editor. Just a row.add() for now. Still in very early stages

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    I see. There's two ways you could go. First, in the row itself like this example - that is just an index so incrementing by one, but you could do the same and keep a running tally. Second, have it in the footer, like this example here.

    Colin

This discussion has been closed.