Handling cells with more than one value

Handling cells with more than one value

pmconsultingpmconsulting Posts: 36Questions: 11Answers: 0

Link to test case: https://bongo.cc/spud/spud/
Debugger code (debug.datatables.net): N/A
Error messages shown: N/A
Description of problem: N/A

I'm putting cases of product in rows of my datatable. Products are cases with a dozen or more individual items, usually of the same type. So, one case may contain 12 bags of potatoes.

There are a few products that combine more than one item. These cases will have 12 of one item and 12 of another. I populate the rows of my table by searching products. A case of products with more than one item puts the details for both items into each cell, using a line feed between so that each cell will display one value, if the case is all one item type, and separate values, one above the next, for those cases with multiple items.

I'd like to adjust my search panes code so that cases containing multiple items will match the criteria for separate values in each cell. Is this possible?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Could you give an example in your test case where that is happening, please - there's a lot going on there,

    Colin

  • pmconsultingpmconsulting Posts: 36Questions: 11Answers: 0

    If you look at the example here: https://datatables.net/extensions/searchpanes/examples/initialisation/simple.html

    Suppose some employees split their time between 1 or more Offices. The Office column might contain "Tokyo, London, New York" for such an employee. I'd like to provide a search pane that shows each unique office and this particular row would match on any of those offices.

    Currently, I'll get a unique value for every unique string in the Office column. The search pane will display Tokyo, New Youk, etc., but it will also contain every unique string, so it will also have a choice for "Tokyo, London, NewYork" because the basic function finds all unique strings in the column.

    I'd like to specify a further parsing of the content of each cell, splitting and trimming the cell contents on ',' and then using those values to create the list of unique string.

    I realize that proper data normalization suggests that only one fact be stored in each cell, however, I've run into so many circumstances where being able to cheat this a little would vastly save space.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Thanks for the explanation. Does this example from this thread show what you're after? That's splitting the string using orthogonal data.

    Colin

  • pmconsultingpmconsulting Posts: 36Questions: 11Answers: 0

    Thank you so much, Colin! It's working after I figured out how to split the contents on the right character. Greatly appreciate all the work you do!

Sign In or Register to comment.