why can't I use $j.current.v.mymethod in controller ?

1 view
Skip to first unread message

Alex

unread,
Mar 19, 2009, 9:29:24 AM3/19/09
to Jamal MVC
HI Timo,

why can't I use $j.current.v.mymethod in controller ?

In my customers_controller.js, I can use
$j.v.customers.mymethod, but i cant use $j.current.v.mymethod .

in my views / customers.js :


$j.v({ Customers: {

mymethod: function(){
// some dom oprate code
}
}

show my js app dir in attach , Thank you !

Picture 1.png

Timo Derstappen

unread,
Mar 19, 2009, 9:39:59 AM3/19/09
to jama...@googlegroups.com
Hey Alex,

2009/3/19 Alex <blacka...@gmail.com>:


> HI  Timo,
>
>     why can't I use $j.current.v.mymethod in controller ?
>
>     In my customers_controller.js,   I can use
> $j.v.customers.mymethod,  but  i cant use $j.current.v.mymethod .
>

Is the customers controller really your current controller. Current
means the one that was referenced in the body class literal.
$j.current doesn't mean it is the controller you are writing code in.

Otherwise this should definitly work. Your filenames and view seems correct.

Cheers,
Timo

--
Timo Derstappen

http://teemow.com
mailto:tee...@gmail.com

Alex

unread,
Mar 19, 2009, 9:34:23 AM3/19/09
to Jamal MVC
HI Timo,

why can't I use $j.current.v.mymethod in controller ?

In my customers_controller.js, I can use
$j.v.customers.mymethod, but i cant use $j.current.v.mymethod .

in my views / customers.js :

Picture 1.png

Alex

unread,
Mar 19, 2009, 10:01:09 AM3/19/09
to jama...@googlegroups.com
yes, customers is my current controller.


I output $j.current.v with console.log($j.current.v) method , the
result is 'Customers', it is correct.

however console.log($j.current.c) ===> undefined' , why ?

Timo Derstappen

unread,
Mar 19, 2009, 10:03:00 AM3/19/09
to jama...@googlegroups.com
> however  console.log($j.current.c)  ===>  undefined'  , why ?

$j.current is already the controller :)

Alex

unread,
Mar 19, 2009, 10:12:51 AM3/19/09
to jama...@googlegroups.com


console.log($j.current) ===> Object name=Customers m=Object
v=Object components=[0]

in your Shouts example, you can use $.current.v.yourmethod, but i
can't in my project
i haven't got it ... :(

Timo Derstappen

unread,
Mar 19, 2009, 10:17:09 AM3/19/09
to jama...@googlegroups.com
>  in your Shouts example,   you can use $.current.v.yourmethod,  but i
> can't  in my project
> i haven't got it ...  :(

As I said I need to see your code. Please paste your html, controller
and view here:

http://paste2.org/new-paste

And post the link.

Cheers,
Timo

Alex

unread,
Mar 19, 2009, 10:36:02 AM3/19/09
to Jamal MVC
Hi Timo,

http://paste2.org/p/167441

Thank you.

my js app dir picture in attach.

Picture 1.png

Timo Derstappen

unread,
Mar 19, 2009, 6:21:14 PM3/19/09
to jama...@googlegroups.com
Hey Alex,

sorry for the delay. I couldn't find the error ...

But I now realized that you should include your models and views
before the controllers. There is no documentation about that, but it
just came to my mind ...

My helpers and build tools haven't been changed for some time now, so
I nearly forgot about this quirk. Otherwise Jamal creates controller.v
on the fly just inheriting from app_view.

Greetings,
Timo

2009/3/19 Alex <blacka...@gmail.com>:
> Alex
>> --~--~---------~--~----~------------~-------~--~----~
>> Sie erhalten diese Nachricht, weil Sie Mitglied sind von Google
>> Groups-Gruppe "Jamal MVC".
>> Für das Erstellen von Beiträgen in dieser Gruppe senden Sie eine E-
>> Mail
>> an jama...@googlegroups.com
>> Um sich von dieser Gruppe abzumelden, senden Sie eine E-Mail an jamal-mvc+...@googlegroups.com
>> Weitere Optionen finden Sie in dieser Gruppe unter http://groups.google.com/group/jamal-mvc?hl=de
>> -~----------~----~----~----~------~----~------~--~---

Alex

unread,
Mar 19, 2009, 6:52:45 PM3/19/09
to jama...@googlegroups.com
Hi Timo,

"But I now realized that you should include your models and views
before the controllers."

That's right !
I modify location of the controller.js , model.js and
view.js be loaded before controller.js , the problem solved ! I can
use $j.current.v.mythod :)
Thank you!

Alex
Reply all
Reply to author
Forward
0 new messages