This discussion is archived
1 2 Previous Next 16 Replies Latest reply: Jan 10, 2013 8:32 PM by shadab550 RSS

Help in creating a search on apex tree node

shadab550 Newbie
Currently Being Moderated
hi all,

can any one please guide me in creating a search on apex tree
please show me how to create a search on apex tree pleaseee

thanks
shadab
  • 1. Re: Help in creating a search on apex tree node
    shadab550 Newbie
    Currently Being Moderated
    Hi,

    can any one help me in this

    thanks
    shadab
  • 2. Re: Help in creating a search on apex tree node
    shadab550 Newbie
    Currently Being Moderated
    hi all,

    can any one guide me on this

    thanks
    shadab
  • 3. Re: Help in creating a search on apex tree node
    Tom Petrus Expert
    Currently Being Moderated
    Exactly what is it you want to achieve?
    You can start by taking a look at this sample application and at this blogpost to see if that helps you.
  • 4. Re: Help in creating a search on apex tree node
    shadab550 Newbie
    Currently Being Moderated
    yes like this only sir but this example consist of 2 to 3 type of functionality i just need to search a node what code should i take please tell me becoz with javascript i m like novice
    please tom help

    thanks
    shadab
  • 5. Re: Help in creating a search on apex tree node
    shadab550 Newbie
    Currently Being Moderated
    sir can You please explain me this code i have tried but i m not getting the result

    steps

    take ur code on to the page and pasted in the Function and global variable declaration section after pasted the css code in inline css code section and then a dynamic action

    Function and global variable declaration
    var l$Tree;
    function searchTree(pWhat){
      $.tree.reference(l$Tree).search(pWhat);
      };
    in line css
    .search{
    border-style:solid;
    border-width:1px;
    border-color:green;
    }
    now created the dynamic action on the button

    dynamic action: search tree
    event: click
    selection type: button
    button: P123_search
    Action: Execute Java script code
    Fire When Event Result Is : TRUE
    Fire On Page Load : not checked
    code: searchTree($v("P123_SEARCH"));

    Affected Elements : nothink

    Please tell me where i m committing a mistake


    i m getting this error also Error: Syntax error, unrecognized expression: #
    *...jQuery(c.node).trigger("change")}function g(){apex.jQuery.isFunction(c.callbacks...*

    Thanks & regards
    Akram

    Edited by: shadab550 on Jan 8, 2013 8:42 PM
  • 6. Re: Help in creating a search on apex tree node
    Tom Petrus Expert
    Currently Being Moderated
    Akram,

    I think the most important part you're missing is to set variable l$Tree to an element that is contained in the tree. The easiest way to do that would be to give your tree region a static id, and then execute this code onload (edit page > Javascript > Execute when page loads):
    l$Tree = $("#myStaticRegionId div.tree");
    Without this reference it won't work! The other code looks fine, and i'd guess the javascript error is because you're trying to execute something on the empty l$Tree variable/tree instance.
  • 7. Re: Help in creating a search on apex tree node
    Joni Vandenberghe Pro
    Currently Being Moderated
    Did you consider just adding it to your WHERE clause of your tree query?
    So do the folowing:
    1. Create a text field
    2. Add a button to submit the page
    3. Add a where clause to your query example
    WHERE UPPER(mycolumn) LIKE '%'||UPPER(:PX_MY_TEXT_FIELD)||'%' OR :PX_MY_TEXT_FIELD IS NULL

    And replace PX_MY_TEXT_FIELD by your item name.

    Edited by: Joni Vandenberghe on 9-jan-2013 2:23
  • 8. Re: Help in creating a search on apex tree node
    shadab550 Newbie
    Currently Being Moderated
    Hi TOM,

    Still i m not getting the result getting the same error sir,

    regards

    akram
  • 9. Re: Help in creating a search on apex tree node
    shadab550 Newbie
    Currently Being Moderated
    hi Joni Vandenberghe,

    see this is my query
    select  case when connect_by_isleaf = 1 then 0
                when level = 1             then 1
                else                           -1
           end as status, 
            LEVEL,
            TRIM(LPAD(' ', 5 * LEVEL - 1)||EXTERNAL_REFERENCE||'  '||TRIM(LPAD(' ', 5 * LEVEL - 1) || J_DESCR)) AS REF_NAME,
            null as icon,
            LPAD(' ', 5 * LEVEL - 1)||EXTERNAL_REFERENCE AS VALUE,
            null as tooltip, 
            null as link 
    from J_user_struc
           start with J_CODIF_ID = '702' and J_CODIF_CODE = '144001' 
           connect by prior J_CODIF_ID = J_HL_ID and prior J_CODIF_CODE = J_HL_CODE
    i m getting the name from 2 col EXTERNAL_REFERENCE and J_DESCR

    regards
    akram
  • 10. Re: Help in creating a search on apex tree node
    Joni Vandenberghe Pro
    Currently Being Moderated
    Well you need to decide what you want to filter on, but it could be something like this:
    select  case when connect_by_isleaf = 1 then 0
                when level = 1             then 1
                else                           -1
           end as status, 
            LEVEL,
            TRIM(LPAD(' ', 5 * LEVEL - 1)||EXTERNAL_REFERENCE||'  '||TRIM(LPAD(' ', 5 * LEVEL - 1) || J_DESCR)) AS REF_NAME,
            null as icon,
            LPAD(' ', 5 * LEVEL - 1)||EXTERNAL_REFERENCE AS VALUE,
            null as tooltip, 
            null as link 
    from J_user_struc
    WHERE UPPER(EXTERNAL_REFERENCE||J_DESCR) LIKE '%'||UPPER(:PX_MY_TEXT_FIELD)||'%' OR :PX_MY_TEXT_FIELD IS NULL
           start with J_CODIF_ID = '702' and J_CODIF_CODE = '144001' 
           connect by prior J_CODIF_ID = J_HL_ID and prior J_CODIF_CODE = J_HL_CODE
  • 11. Re: Help in creating a search on apex tree node
    shadab550 Newbie
    Currently Being Moderated
    Joni Vandenberghe

    done the same think but in my toad its working but on application its not working

    thanks
    akram
  • 12. Re: Help in creating a search on apex tree node
    Joni Vandenberghe Pro
    Currently Being Moderated
    Did you check if the text item has a value in the session? If not that will be the cause. After you type text in the item remember to submit the page to send the value to the session.
    If it has a value in the session then create an example on apex.oracle because debugging this way is to hard.
  • 13. Re: Help in creating a search on apex tree node
    Tom Petrus Expert
    Currently Being Moderated
    Can you try to add this in the onload section, after the l$Tree = ... line so that your onload looks like this:
    l$Tree = $("#myStaticRegionId div.tree");
    $.tree.reference(l$Tree).settings.data.async = false;
    As i described in the blogpost, without this setting an ajax call is made and will fail (always), and the search too will fail.

    If you still have an error after this, can you provide some more details?
    When do you get this error? Is it when you click the search button? Do you have other javascript in your page? Can you check what file the error is located in (usually this is mentioned in the console of for example firebug or in the developer tools in ie)?
  • 14. Re: Help in creating a search on apex tree node
    shadab550 Newbie
    Currently Being Moderated
    Tom,

    their is no other javascript on my page

    when i run this
    var l$Tree
    l$Tree = $("#TREEID div.tree");
    $.tree.reference(l$Tree).settings.data.async = false;
    function searchTree(pWhat){
      $.tree.reference(l$Tree).search(pWhat);
      };
    searchTree($v(P123_SEARCH));
    in the fire bug console i getting the node highlighted but when i click the search button its not giving the result

    regards
    akram
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points