open flyout modified

i made gadget that google search.

so if i insert keyword and click search button.

 than flyout is show. in flyout, result of search.

but its so confuse. my method is below...

===========================================================
//if search clicked
..........
.....................
System.Gadget.Flyout.show = true;
System.Gadget.Flyout.document.getElementById("result").innerHTML = resultHtml;
..................
..........
===========================================================but this is not operate properly. if i click search button. than flyout show with no result.

than i click search button on more time.

than result show in flyout.

what wrong with above code ~

plz feed any~

good luck gentleman and sorry about my fool english

.- hum in Kor -


Answer this question

open flyout modified

  • Will Durning

    You need to wait until the Flyout is showing before setting "result". Do this by moving the update code into a function, and set System.Gadget.Flyout.onShow to that function:

    System.Gadget.Flyout.onShow = flyoutShowing;
    ...
    System.Gadget.Flyout.show = true;
    ...

    function flyoutShowing() {
    System.Gadget.Flyout.document.result.innerHTML = resultHtml;
    }

  • BilalShouman

    oh... its good information to me.

    anyway i resolve my problem with your help Jonathan~ thanks very much~ !!!

    it is very important that time interval between flyout show and render to flyout..

    so.. fantastic result shown to me!. thank everyone~!



  • sweet_salt

    1) if you set something simple, like "hello" to the innerHTML, does it work

    yes of course. but same as above problem.

    This means it doesn't show either

    You should call it in the order you wrote above, first show=true, then set the innerHTML, because the flyout HTML gets reloaded every time you show it.

    Could you post the flyout HTML here Since you are accessing the result element I guess you have some template.


  • Tomys

    Two questions:

    1) if you set something simple, like "hello" to the innerHTML, does it work

    2) can you check whether the the content you set is really set Eg. if you read the System.Gadget.Flyout.document.getElementById("result").innerHTML, is there what you expect


  • Rick Kriscka

    thanks your feed Jan Ku era ..

    flyout HTML code below~

    -----------------------------------------------------------------------------------------------------

    var M_MESSAGE_FAILED = "Failed...<br/>Content is not exist...";

    function onSearchClick(p_form){
    var m_keyWord = p_form.keyword.value;
    var m_query = M_QUERY.makeQuery(m_keyWord);
    doProcFlyoutOpen();
    if(m_query == null){
    renderResult(M_MESSAGE_FAILED,10);
    return;
    }else{
    M_AJAXENGINE.openXHR("GET",m_query,updateResult);
    }
    }

    function updateResult(p_result){
    p_result = p_result.getElementsByTagName("content")[0].firstChild.nodeValue;
    renderResult(p_result,10);
    }

    function renderResult(p_string,p_size){
    p_string = "<div style=\"font-family:tahoma;font-size:" + p_size + "px;\">" + p_string + "</div>";
    System.Gadget.Flyout.document.getElementById("vemFrame").innerHTML = p_string;
    }

    -------------------------------------------------------------------------------------------------------

    above onSearchClick function fired when i click search button. if "m_query != null"

    then result is go straight rendering in flyout - its perfect~

    but when "m_query==null" ..then flyout is blank..

    whats wrong ~ In "M_AJAXENGINE.openXHR("GET",m_query,updateResult);"... updateResult(callback function)

    is call "renderResult(M_MESSAGE_FAILED,10);" same as when

    if(m_query == null){
    renderResult(M_MESSAGE_FAILED,10);
    return;
    }

    this is very stange.~~ isnt it ~

    what's wrong with it my god~ ;-(



  • PCSQL66

    1) if you set something simple, like "hello" to the innerHTML, does it work

        yes of course. but same as above problem.

     2) can you check whether the the content you set is really set Eg. if you read the System.Gadget.Flyout.document.getElementById("result").innerHTML, is there what you expect

        yes. i did it . also same as above problem.

        if there is no content set. then result not appear in result flyout when click searchbutton twise.

        so..can you  tell me about sequence

        what is a first step between "System.Gadget.Flyout.document.getElementById("result").innerHTML="...."  and

       " System.Gadget.Flyout.show=true;" .

     

    thanks. feed any plz



  • open flyout modified