Checkbox withing cell without using a join table

Checkbox withing cell without using a join table

YoDavishYoDavish Posts: 123Questions: 46Answers: 3

Link to test case:
Hello I want to do something simliar to this below, where we have a cell that has a checkbox of values.

https://editor.datatables.net/examples/advanced/joinArray.html

However, instead of a one to many table join. We want to pass in a string such as:

"STAT|RUSH|NORMAL|LOW", explode that into an array, then json encode it to be used as the checkbox values.

Is there another example of how to build a checkbox into a cell without using the joined table?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Answer ✓

    Hi,

    I don't think we do actually have an example of that, however, what you want is the separator option of the checkbox field - e.g. in this case:

    {
      name: 'myField',
      label: 'Options',
      type: 'checkbox',
      separator: '|'
    }
    

    Then it will expect a string in the data for that field and return a string, delimited by a pipe.

    Regards,
    Allan

  • YoDavishYoDavish Posts: 123Questions: 46Answers: 3

    @allan

    I tried doing it this way:
    {
    "label": "Task Flags",
    "name": "task.taskFlags", // the database.column of where it will be stored?
    "type": "checkbox",
    "separator": "|",
    "ipOpts": [
    [
    "STAT|RUSH|NORMAL|LOW"
    ]
    ]
    }

    But it did not work, where do I pass along the string delimited by the pipe line?

  • YoDavishYoDavish Posts: 123Questions: 46Answers: 3
    edited November 2021

    Nvm I got it to work now:

    {
            "label": "Task Flags",
            "name": "task.taskFlags",
            "type": "checkbox",
            "separator": "|",
            "ipOpts": [
                {
                    "label": "STAT",
                    "value": "STAT"
                },
                {
                    "label": "RUSH",
                    "value": "RUSH"
                },
                {
                    "label": "NORMAL",
                    "value": "NORMAL"
                },
                {
                    "label": "LOW",
                    "value": "LOW"
                }
            ]
        }
    

    I'll need to figure out the inline editing next, currently it only shows a checkbox without the labels next to them if you double cick into the cell to try to select a checkbox.

Sign In or Register to comment.