Scroll-To Box

Scroll-To Box

kooldabizkooldabiz Posts: 2Questions: 0Answers: 0
edited August 2013 in General
I have a TablePress table (powered by DataTables) in one of my WordPress webpages. It's used to list terms with 1 or more words in one column and their definitions in another column. It has the usual "Search" box that filters-to a word or words in the term column as-you-type. What I need is one that scrolls-to the word or words as-you-type (not filter).

The reason is that I have links to other terms within the table that, when clicked, scrolls to them. The links are very fast. If the table is filtered to a term it won't scroll because there is nothing to scroll to. Keeping the table unfiltered makes moving from term to term (row to row) with these links very quick and convenient.

To see what I mean go to http://poweranddata.info/knowledge-center/terminology/#link-table-1-zWebsite. In the Search box type "ampere". It should filter-to ampere. Now click on the word "ampacity" in green. You should see that nothing happens. Now delete "ampere" from the Search box, scroll down to "ampere", and click on ampacity again. It should scroll-to it (not filter-to it). If you click around on the different green links you'll get a feel for what I'm trying to accomplish.

I heard JS might be able to get the job done, but I don't know JS. Closest thing I could find in the DataTables website that might somehow be adapted to help accomplish this is the .fnScrollToRow function. Couldn't find anything in the forums that talks about its use in conjunction with an input box.

It would be a huge help if someone could give me all the code needed to add to my TablePress table shortcode [table id=1/] so that I would end up with a Scroll-To box as described above. Thanks so much for your consideration.

Replies

  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    Maybe this helps: http://stackoverflow.com/questions/6677035/jquery-scroll-to-element
  • kooldabizkooldabiz Posts: 2Questions: 0Answers: 0
    Thanks. That's exactly what I was looking for. Now I just need to know how to make it scroll my TablePress table via its short code [table id=3]. The example in the link you gave only applies the 'scroll to element' code to a generic two row table below the code. Any ideas?
This discussion has been closed.