Page 1 of 2 12 LastLast
Results 1 to 15 of 22

Thread: Javascript :Table filter help required

  1. #1
    Join Date
    May 2012

    Javascript :Table filter help required

    Hi Guys,
    I have attached a js.txt file here with this post. The html in that file shows some data in table format. I need to have a filter (drop-down) above the "Status" column which will have two values :

    i) show all
    ii)only valid status

    Upon selecting "show all" it will show all the status "IN", "CO" and "-".
    But selecting "only valid status" will discard "-" and will only show "IN" and "CO".

    Please notice, I created a "Choose view filter" drop-down just above the table.
    I need exactly same drop-down above "Status" column which will work as per
    above explanation.


  2. #2
    Join Date
    May 2006
    Somewhere behind your screen
    have never seen such a weird markup before
    signature under construction

  3. #3
    Join Date
    May 2012

    In reply to Javacript:table filter help

    Hi ,
    Please let me know what was weird ? I am confused .


  4. #4
    Join Date
    May 2006
    Somewhere behind your screen
    i meant things like these:

    <html>Choose view filter</html><html><br></html>
    signature under construction

  5. #5
    Join Date
    May 2012

    Javascript:Table filter help

    Hi padonak,

    You may ignore that part. I hope you have understood the requirement.
    The table structure is clear I guess. I need just a filter above the "Status"
    column which is a drop-down and will work as explained before.

    I need help on the Javascript code to implement that.

    Please let me know if you have any ohter query.


  6. #6
    Join Date
    Nov 2010
    I didn't look at your zip file, but this is the basic idea - maybe you can adapt it...

    <table width="75%" border="1" id="mytable">
        <td><select onchange="showRows(this.value)">
    <option value="all">show status</option>
    <option value="all">all</option>
    <option value="active">valid</option>
    <script type="text/javascript">
    function showRows(val){
    for (var i = 0; i < mytab.rows.length; i++) {
    if (val=="all"){
    		} else {
    if (mytab.rows[i].cells[1].innerHTML=="-"){

  7. #7
    Join Date
    May 2006
    Somewhere behind your screen
    the main headache was caused by rowspans. this script acts the same to the one posted by xelawho, but it uses JQuery framework (see the linked script) and it hides and shows those rowspans.

    to get it working you must set attribute id="maintab" for the main table or it will hide and show another table's rows on the page also. it is highly recommended to fix the markup or it may work incorrectly because it's logic is based on it.

    from your code, every Command cell sibling to a cell having Status "-" has no links but just text. this was taken as a token.

    tested in: Opera, IE, FF, Chrome, Safari
    signature under construction

  8. #8
    Join Date
    May 2006
    Somewhere behind your screen
    the archive updated. there's no need to set the main table id manually, it is set automatically
    signature under construction

  9. #9
    Join Date
    May 2012

    Javascript Table Filter

    Hi Padonak,

    Thanks for the solution. It is working perfectly.
    But the only problem it is not working in all the versions of
    firefox and internet explorer. Only on Firefox, it is
    working but not on others.

    Do I need to change anything to make it work on all any browser
    irrespective of its version ?

    Please help.

    Thanks in advance.

  10. #10
    Join Date
    May 2012

    Table filter

    Hi Padonak,

    Sorry. It was my mistake. It is working in all browsers.


  11. #11
    Join Date
    May 2006
    Somewhere behind your screen
    good to hear )
    signature under construction

  12. #12
    Join Date
    May 2012

    JavaScript: Table Filter

    Hi Padonak,
    The solution you sent is working perfectly for that html, but showing some discrepancy in the filtered data for two other htmls. I am attaching the other
    two html (in ".txt", please save them in html to check) for which it is partially working.

    1. notWorking_1.txt -> There are 11 valid values for "Status" column including 'ER' and 'OK', but only 8 are coming when filtering. Because of the 'rowspan' of the cells under "Task" and "Command" columns

    2 notWorking_2.txt -> Same thing and even more interesting. When all the value of "Status" columns are "-" for a particular rowspan , then it is coming.
    But in this example one cell is having "IN" for a rowspan and that is not coming.
    Please check the "task_template_qualify_dep" row should come but it is not coming.


  13. #13
    Join Date
    May 2006
    Somewhere behind your screen
    ok i'll take a look at these files and let you know
    signature under construction

  14. #14
    Join Date
    May 2012

    Table filter

    Hi Padonak,

    I consolidated the two htmls for your ease of working. I am attaching that.
    For finding the discrepancy you can focus on three consecutive cells under
    the "Task" column having value "checkRsf" , "checkRsf1" and "checkRsf2" .

    The "Status" filtering for "checkRsf" is working fine. Problem is the other two columns i.e "checkRsf1" and "checkRsf2". I hope you can easily find that for these two columns the rows having "IN" value is not coming while choosing
    "onlyValidStatus" in the drop-down above the "Status" column.

    Please find the file attached.

    Thanks a lot.

  15. #15
    Join Date
    May 2006
    Somewhere behind your screen
    pls read comments in the txt-file
    signature under construction

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.11455 seconds
  • Memory Usage 3,004KB
  • Queries Executed 15 (?)
More Information
Template Usage (36):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (15)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (15)postbit
  • (15)postbit_onlinestatus
  • (15)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (74):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates