Alpha Video Training
Results 1 to 7 of 7

Thread: Hide Quick Search Bar When Nothing To Search

  1. #1
    Member
    Real Name
    Lily Von Ohlen
    Join Date
    Aug 2012
    Posts
    211

    Default Hide Quick Search Bar When Nothing To Search

    Does anyone know how to hide the search box and row if there isn't anything to search?

    I posted a photo to clarify what I am talking about: http://screencast.com/t/NERmNIgx6e

    Thanks so much for your time :-)

    -Lily

  2. #2
    "Certified" Alphaholic TheSmitchell's Avatar
    Real Name
    Sarah
    Join Date
    Apr 2012
    Posts
    1,315

    Default Re: Hide Quick Search Bar When Nothing To Search

    Yes?

    Code:
    $('id.of.search.area').style.display = 'none';

  3. #3
    Member
    Real Name
    Lily Von Ohlen
    Join Date
    Aug 2012
    Posts
    211

    Default Re: Hide Quick Search Bar When Nothing To Search

    Hi Sarah,

    Thanks so much for writing to me. I am not good at all with javascript but I took you code a put it into the Client-side-events using the onObjectInitialize and was successfully able to hide it but I am guessing I need some sort of statement to go along with it and don't really know how to do that

    I see in the grid properties the "'Total Records' Message Text" uses this:{Total_Records} but I didn't know if I could just steal that to use it.

    The code below doesn't work but I would have been shocked if it could, is there a way that this could work?

    Thanks so much!

    Lily

    if {Total_Records} = < 1

    $('PROSPECTS_CLIENT_LIS_1649OQRG.QUICKSEARCHLABEL').style.display = 'none';
    $('PROSPECTS_CLIENT_LIS_1649OQRG.QUICKSEARCH').style.display = 'none';
    $('PROSPECTS_CLIENT_LIS_1649OQRG.QUICKSEARCH.SUBMITBUTTON').style.display = 'none';

    end if

  4. #4
    "Certified" Alphaholic TheSmitchell's Avatar
    Real Name
    Sarah
    Join Date
    Apr 2012
    Posts
    1,315

    Default Re: Hide Quick Search Bar When Nothing To Search

    The total records is harder because it's largely undocumented...

    Code:
    //Get total records in grid
    var totalRecords = {grid.Object}._totalRecordsInGrid
    
    // if statements use { and } in javascript to mark the if block
    if (totalRecords <= 1) {
        $('{grid.ComponentName}.QUICKSEARCHLABEL').style.display = 'none';
        $('{grid.ComponentName}.QUICKSEARCH').style.display = 'none';
        $('{grid.ComponentName}.QUICKSEARCH.SUBMITBUTTON').style.display = 'none';
    }
    Catch: If _totalRecordsInGrid is not populated before onObjectInitialize is called, then this will not really do what you want. You'll figure that out pretty quickly if your code is always hiding everything, even if there are more than 1 records.

    ---
    Sarah

  5. #5
    "Certified" Alphaholic TheSmitchell's Avatar
    Real Name
    Sarah
    Join Date
    Apr 2012
    Posts
    1,315

    Default Re: Hide Quick Search Bar When Nothing To Search

    You should check out this thread, as well. It has some information in it relevant to what you're trying to do: http://msgboard.alphasoftware.com/al...ht=hide+search

    Maybe. If not, it's a worthwhile read anyway.
    Last edited by TheSmitchell; 03-13-2013 at 05:01 PM.

  6. #6
    "Certified" Alphaholic TheSmitchell's Avatar
    Real Name
    Sarah
    Join Date
    Apr 2012
    Posts
    1,315

    Default Re: Hide Quick Search Bar When Nothing To Search

    Lastly, if you're experiencing problems, launch your grid in FireFox with FireBug running. Have the Console tab open. It will display any JavaScript errors that might be occurring. Super helpful for figuring out what is going wrong. jsErrors.png

  7. #7
    Member
    Real Name
    Lily Von Ohlen
    Join Date
    Aug 2012
    Posts
    211

    Default Re: Hide Quick Search Bar When Nothing To Search

    I took your code and put it on the "ongridInitializeComplete" and it works perfectly :-)

    Thank you so much for your help, I really appreciate it!!! I'm going to check that other thread that you posted now too. There is always more to learn :-)

Similar Threads

  1. Suppress "blank" option in Search or Force Selection in Quick Search
    By Dfred in forum Application Server Version 10 - Web/Browser Applications
    Replies: 6
    Last Post: 04-04-2012, 10:28 AM
  2. Quick Search location
    By harrison4411 in forum Application Server Version 9 - Web/Browser Applications
    Replies: 0
    Last Post: 08-02-2010, 04:53 PM
  3. Quick Search
    By frankbicknell in forum Application Server Version 10 - Web/Browser Applications
    Replies: 5
    Last Post: 02-13-2010, 10:49 AM
  4. Quick Search
    By GarthMc in forum Alpha Five Version 10 - Desktop Applications
    Replies: 1
    Last Post: 09-16-2009, 10:01 PM
  5. Grid Quick Search & Search Part Issue
    By den1s in forum Application Server Version 9 - Web/Browser Applications
    Replies: 0
    Last Post: 06-29-2009, 10:47 AM

Bookmarks

Posting Permissions

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