I have a DataTable connected to a SPList and I want to apply a filter according to some Dropdowns
Lets say I have 3 dropdowns with "System", "CompanyName" and "Process". If someone chooses one option from System dropdown, the table will filter all the info according to the System selected, then if someone chooses a Process, the table will be filtered with the selected System and the selected Process, and so.
The problem is that my DataTable kind of filters in random way, sometimes it filters sometimes it doesnt, I only want an idea how to make this possible because I have like 5 or 6 Dropdowns so I need to combine many If with || ( Or ) function
Filtering on on the DataTable works the same as the filtering on Galleries.
If you have multiple dropdowns you need to decide first if you want Or or if you want And. Or is probably not best because it will basically only put one at a time so I would suggest using AND. If you want to allow them to not use all the dropdown then you can include an If statement that says If Dropdown2 is blank then only look at Dropdown1 and so on (I can help you more with that if you need)
So, using And if you just have two drop downs you would put on the items for the DataTable
You can go on as long as you need to but that is the basics of it.
Also, I put on here how to do for dropdown because that is what you were using but I would suggest you do combo boxes instead...it allows for autofill so good for users and when you want to clear it out you can just click the X instead of having to put in code for that. You won't have to change anything on the SPList to swap to that, just a different control. But everybody is different...just my two cents for what it is worth.