nickatomlin / Parks

Using Sheetsee.js to provide information about RI recreation areas.
https://Designist.github.io/Parks/
Other
0 stars 1 forks source link

Filter by activity type, etc. #2

Closed nickatomlin closed 8 years ago

nickatomlin commented 8 years ago

The filter functionality is currently a text-only search. This needs to be improved to let the user select

nickatomlin commented 8 years ago

Scaling down this feature, filtering will now only include the improved textbox and a dropdown for activity.

nickatomlin commented 8 years ago

Almost entirely fixed -- the only remaining issue is that the table is updated only by changing the input and not select field. So if you want to see all biking opportunities, for example, you still need to hit 'space' in the input field.

nickatomlin commented 8 years ago

Working as of 58c1ba493c292862638d663ca4b83eeceb402830. Using $('#activityFilter option').on('click', function() { ... });, I was able to create a keyup-like event for drop-down boxes. I used this to call searchTable, but since the keyup didn't provide me the text required by searchTable's parameters, I used document.getElementById("tableFilter").value to grab the text in the input field.

I also had to include $('.spotRow').first().click(); in the sheetsee.js file, which selects the first row of the table after filtering. Normally this is handled by the index.html file, but it didn't work quickly enough because of the getElementById query. When used in index.html, this merely selected the first row of the previous search. This was removed from index.html in 0431e2d3ed8845b4e451b6988ab5858731f4f5a1.

This is a slightly hacky way of handling the issue, using getElementById in lieu of tableOptions, but I'm not seeing any performance issues thus far. It's only one getElementById query per drop-down selection, so it shouldn't be much of an issue.