Subtract 1 from the value of empty cell grouping in SearchPanes

Subtract 1 from the value of empty cell grouping in SearchPanes

bfarkasbfarkas Posts: 181Questions: 48Answers: 0

I have a hidden row which i have fixed all other calculations to take care of. When i use SearchPanes, the empty cell field shows as 1 extra than it should because of this. Is there an easy way to have 1 subtracted from the returned value for empty cells in SearchPanes? If I have to go full custom, I would need to figure out how to add unique values as the values that can be in this column will be changed constantly.

This question has an accepted answers - jump to answer

Answers

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @bfarkas ,

    I'm not sure I am following you. Are you saying that the empty option searchpanes creates is returning one more than it should? Could you please post a link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Thanks,
    Sandy

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    No, it is returning the technical correct number, what I am saying is that I have purposfully hidden 1 row that i do not want to have counted ever, so I want to be able to subtract 1 form the real value so that it is always correct.

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    Sounds like this hidden row you don't want Datatables to know about or process. If thats the case maybe you can move it to an additional header or footer row that is hidden. Might be easier than trying to make adjustments in SearchPanes.

    Kevin

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    Not quite, this is that same row you had helped me with a while back and hiding it from the pages count etc. I need datatables to both know about it and process in the background as well as during different specific points, I just don't want it visible in things like searchpanes.

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    Sorry I don't remember the specifics about it. Maybe you can put together an example so we ( Sandy likely :-) can take a look.

    Kevin

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    Heres a current draft:
    https://live.gopds.net/nyl/suite/webspace_view/p200-accelerator_~_80b618ebca/tool.html

    You would need to be a new user, define a couple nests and enter some users. The searchpanes are hidden in a filter nests view which you can turn on using the nests menu or by using shift+f

    Searchpanes is working correctly though, I am just trying to come up with a way to subtract 1 from the null category.

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @bfarkas ,

    Each of the SearchPanes uses Datatables to display the options to the user. I would iterate over these table and use the rows() api method to find the correct row that you want to change, then edit it's contents however you please.

    Thanks,
    Sandy

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    Thanks Sandy, what is the name of these data tables since I do not set them? Do they have a set structure?

  • sandysandy Posts: 913Questions: 0Answers: 236
    Answer ✓

    Hi @bfarkas ,

    Try something along the lines of the following.

    for(var i = 0; i < $('div.dtsp-searchPane table').length; i++){
        console.log($($('div.dtsp-searchPane table')[i]).DataTable().rows().data());
    
        // Do whatever you want to do
      }
    

    Effectively what you are doing is just running the DataTable() method on the tables to get the API instance.

    Thanks,
    Sandy

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    Interesting, the row indexes seem to change each time I load/refresh the page and/or searchpanes so it is tough to universally identify that row, since it is the null value too.

This discussion has been closed.