Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: how to know arg of function

  1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    14

    Default how to know arg of function

    i'm sorry, still nubie here.

    i was trying extcore manual, when come to hover i find difficulties, here the example:
    Code:
    // handles when the mouse enters the element	
    function enter(e,t){
        t.toggleClass('red');
    }
    // handles when the mouse leaves the element
    function leave(e,t){
        t.toggleClass('red');
    }
    // subscribe to the hover
    el.hover(over, out);
    then i try to create similar but using fly
    Code:
    Ext.fly('test').hover(function(e,t){t.toggleClass('red')}, function(e,t){t.toggleClass('red')});
    above code say error that t.toggleClass is not a function, inspecting using console.debug t is dom element, so that's why i cant use the function. Either the manual is wrong or i did something wrong in my code, direct me please?.

    secondly, how can i know that the first argument of hover (overFn) can take 2 args or more, i try to find this args in api docs, but cant find it. can anybody explain it to me?, or direct me to read somewhere.

    and one thing, when i search action, api docs return ext.action but when i click it, it return 404 html error.

    thanks in advance.

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    What API docs are you looking at?

  3. #3
    Ext User
    Join Date
    Apr 2008
    Posts
    14

    Default

    i'm looking at ext core docs which ship with extcore zip file, and i try too with http://www.extjs.com/products/extcore/docs/

  4. #4
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996

    Default

    The Ext core manual is relatively new, still has several documentation problems. The bug you found was reported in this thread http://extjs.com/forum/showthread.ph...909#post313909.

    The Ext API Docs on the hover method look like they could use some elaboration as well. The arguments passed to the handler are currently undocumented.

    It looks like the handlers are passed 3 parameters: event, DOM target (not Ext Element), and options specified in hover's 4th argument (listener options and custom properties).

    Manual/docs should be corrected to something like:
    Code:
    // handles when the mouse enters the element	
    function enter(e, t, options){
        //t.toggleClass('red');
        // t is DOM element, need to convert to Ext.Element
        var el = Ext.get(t);
        el.toggleClass('red');
    }
    
    // handles when the mouse leaves the element
    function leave(e, t, options){
        //t.toggleClass('red');
        var el = Ext.get(t);
        el.toggleClass('red');
    }
    
    var el = Ext.get('elId2');
    
    var options = {
        foo: 'bar',
        single: true
    };
    
    // subscribe to the hover
    //el.hover(enter, leave, el, options);
    Ext.fly('elId2').hover(enter, leave, el, options);

  5. #5
    Ext User
    Join Date
    Apr 2008
    Posts
    14

    Default

    thanks very much MJ, it's a relieve, been trying hard to find my mistake.
    i'll be waiting for it to be fix.

    ratno

  6. #6
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996

    Default

    To clarify, I think it is a documentation bug, so nothing for you to 'wait for'. I don't know that there's a code bug.

  7. #7
    Ext User
    Join Date
    Apr 2008
    Posts
    14

    Default

    apologize for my poor english, i mean the fix/appending any miss docs in api documentation, coz i feel helpless without it.
    i'm not gonna wait as an idle, but while waiting i think i can still struggle to learn this, and i think it'll not as hard as to grasp extjs concept, coz i feel failed to get to understand the whole system in extjs 2, i'll start over again in this ext-core, hopefully in the future help me to understand extjs 3.
    i like to read this forum, but sometimes i just cant keep it with my pace, i'll try harder then.
    thanks again MJ.

  8. #8
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    If you just debugged your code, you would easily find out that the second argument is DOM element, not an Ext.Element

  9. #9
    Ext User
    Join Date
    Apr 2008
    Posts
    14

    Default

    Quote Originally Posted by Animal View Post
    If you just debugged your code, you would easily find out that the second argument is DOM element, not an Ext.Element
    Quote Originally Posted by ratno View Post
    above code say error that t.toggleClass is not a function, inspecting using console.debug t is dom element, so that's why i cant use the function. Either the manual is wrong or i did something wrong in my code, direct me please?.
    yups i was doing that, but for nubie like me my assumption was that ext-core, its manual and its api docs is flawless. so i tend to find maybe something wrong with me, if i without repeating trying then come to ask into forum that would be bad isnt it.

    but my main question was not that, it was how can i find the arguments for callback function as the title of my question in this case argument for overFn and outFn in hover function. And i was relieve knowing that "the arguments passed to the handler are currently undocumented" as MJ said. I relieved because the fault wasnt mine (coz i try to find it in api doc but found nothing), that's means alot to me as whether i learn this on track or not.

  10. #10
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    It just uses the mouseenter and mouseleave events.

Page 1 of 2 12 LastLast

Posting Permissions

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