Adding Last Condition to DataTable Not Working as Intended

Adding Last Condition to DataTable Not Working as Intended

zgoforthzgoforth Posts: 482Questions: 91Answers: 2

Link to test case: https://jsfiddle.net/BeerusDev/xsbeac82/20/

Hello,

I am trying to add a last condition to this filter, where it shows all items that the current user has created, but when I add this filter, it breaks the filter. Before adding it everything else worked fine. As of now, it should only show one item with the matching id of 26, but it is showing both of the other items who were created by AuthorID 25.

This question has an accepted answers - jump to answer

Answers

  • zgoforthzgoforth Posts: 482Questions: 91Answers: 2

    Updated fiddle, still the same issue https://jsfiddle.net/BeerusDev/xsbeac82/33/

  • kthorngrenkthorngren Posts: 14,169Questions: 25Answers: 3,340

    I guess you are referring to this if statement:

    if(tableUserTitle == thisUserTitle || authorID2 == createByID)

    This is an OR if statement meaning it will be true if the comparison on the left of || is true or the right is true. Sounds like you might need to change this to an AND if by replacing || with &&.

    Kevin

  • zgoforthzgoforth Posts: 482Questions: 91Answers: 2

    I did not notice I made that logical mistake, fixed it but the problem is for the first table https://jsfiddle.net/BeerusDev/xsbeac82/39/. If the queryString is not matching the list item id, then I want it to show all rows if the tableUserTitle matches the thisUserTitle and if authorID1 == createByID . That way users can only see their row, and whoever created tasks can see all of the tasks that they have created

  • kthorngrenkthorngren Posts: 14,169Questions: 25Answers: 3,340
    Answer ✓

    I'm not sure I totally understand. Maybe you need to incorporate the use of parenthesis in you if statement to compare the way you want.

    Kevin

Sign In or Register to comment.