Re: Dynamic Element Help
Re: Dynamic Element Help
- Subject: Re: Dynamic Element Help
- From: Johnny Miller <email@hidden>
- Date: Thu, 31 Jan 2013 19:12:15 -1000
Cool. By using appendChildrenToResponse it now works!
There is an extra artifact (I need to wrap the WOHyperlinks with an LI) that I'll need to figure out how to get rid of. I'm going to take a peek at WODynamicGroup and see if I can figure out the incrementing of the element id.
Thanks a million!
On Jan 31, 2013, at 6:50 PM, Chuck Hill <email@hidden> wrote:
>
> On 2013-01-31, at 8:35 PM, Johnny Miller wrote:
>
>> So the process is like this:
>>
>> In the Menu constructor // find all the children who are menu items
>>
>> In the Menu appendToResponse
>>
>> // write some html
>> // loop through children
>> // child.appendToResponse
>
> Rather than that, call appendChildrenToResponse. For invoke, use invokeChildrenAction
>
> That will at least get you closer.
>
>> // close off the html
>>
>> Then in the Menu Item constructor // find all the children who are WOHyperlinks
>>
>> In the appendToResponse
>> // write some html
>> // loop through the children
>> // child.appendToResponse
>> // close off the html
>>
>> So when I add the logging for the context.elementID() in both Menu and Menu Item I see that they have the same element ID. Do I need to manually increment them?
>
> Your code is causing code in super to NOT get called and that code is what manages the element IDs. So either you need to call it (see above) or you need to manage these on your own.
>
> Chuck
>
>
>
>>
>> Thanks a lot!
>>
>> p.s. here is a screenshot of the final output. It's a little menu (that I have all over the place) that has a little popup. The motivation is to stop writing a bunch of HTML every time I use it.
>>
>> <Screen Shot 2013-01-31 at 11.20.12 AM.png>
>>
>>
>> On Jan 31, 2013, at 5:34 PM, Chuck Hill <email@hidden> wrote:
>>
>>>
>>> On 2013-01-31, at 6:26 PM, Johnny Miller wrote:
>>>
>>>> I'm kind of stumbling in the dark.
>>>>
>>>> I put a logging statement on invokeAction for the menu, menu item and erxhyperlink. And in ERXHyperlink I added a logging statement for the sender and element ids
>>>
>>> Try doing the same for appendToResponse
>>>
>>>
>>>>
>>>> So I get something like this:
>>>>
>>>> MENU IA...
>>>> MENU ITEM IA...
>>>> ERXH IA
>>>> 0.9.1.13.1.5.1.5 (sender)
>>>> 0.9.1.13.1.5.1.5.1.1 (element)
>>>>
>>>> So that ends up returning null because the call to super is null and then it doesn't satisfy the check to see if it should invoke action on the child elements (which makes sense because it should invoke action on this element).
>>>>
>>>> Not sure what to do at this point except scratch the idea?
>>>
>>> What that looks like to me is that the generation of the elementID during append to response is different from invokeAction. What outputs 0.9.1.13.1.5.1.5 during appendToResponse?
>>>
>>> Are you outputting the HTML for the hyperlink in your own code? If so, you are not properly incrementing and decrementing the elementID.
>>>
>>> Chuck
>>>
>>>
>>>>
>>>>
>>>>
>>>> On Jan 31, 2013, at 3:27 PM, Chuck Hill <email@hidden> wrote:
>>>>
>>>>> Generally, when senderID().equals(elementID()) the action is for that component
>>>>>
>>>>>
>>>>> On 2013-01-31, at 4:21 PM, Johnny Miller wrote:
>>>>>
>>>>>> Yes. I guess my question is I'm wondering if there is a way to use the senderID to find the right child element?
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Jan 31, 2013, at 2:18 PM, Chuck Hill <email@hidden> wrote:
>>>>>>
>>>>>>>
>>>>>>> On 2013-01-31, at 4:08 PM, Johnny Miller wrote:
>>>>>>>
>>>>>>>> Oops... looks like I didn't cc the list on that last one.
>>>>>>>>
>>>>>>>> So if I override invokeAction in MenuItem
>>>>>>>>
>>>>>>>> And I print out the context.elementID() and context.senderID() they match with something like: 0.9.1.13.1.5.1.5
>>>>>>>> But the url has an extra value: 9.0.9.1.13.1.5.1.5
>>>>>>>>
>>>>>>>> I'm a little lost as to how to interpret that?
>>>>>>>
>>>>>>> That depends on what you are looking at.
>>>>>>>
>>>>>>> "/cgi-bin/WebObjects/KMIWebCMSApp_1.woa/-5570/wo/43.0.9.1.13.1.5.1.5"
>>>>>>>
>>>>>>> The number right after /wo/ is the context ID (43 in the URL above) and will increase with each request. The following numbers are the element ID (.0.9.1.13.1.5.1.5). Is that the extra value you are talking about?
>>>>>>>
>>>>>>> Chuck
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Jan 31, 2013, at 1:33 PM, Johnny Miller <email@hidden> wrote:
>>>>>>>>
>>>>>>>>>
>>>>>>>>> For the uninitiated how would I "step through" the context id during the invoke action phase? I believe I've seen that somewhere... Do you happen to know of a component I could use an example?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Jan 31, 2013, at 1:17 PM, Chuck Hill <email@hidden> wrote:
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 2013-01-31, at 2:36 PM, Johnny Miller wrote:
>>>>>>>>>>
>>>>>>>>>>> On Jan 31, 2013, at 12:22 PM, Chuck Hill <email@hidden> wrote:
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 2013-01-31, at 2:02 PM, Johnny Miller wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Dear Guru,
>>>>>>>>>>>>
>>>>>>>>>>>> I feel like I should come to WOWODC with a flowing beard and long robes.
>>>>>>>>>>>
>>>>>>>>>>> Now that would be awesome.
>>>>>>>>>>
>>>>>>>>>> It is probably not considered unusual in Montreal.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>> I'm not overriding invokeAction on either Menu or MenuItem is that the mistake?
>>>>>>>>>>>>
>>>>>>>>>>>> I am just guessing from the symptoms. "Menu finds all it's MenuItems and then the MenuItem finds all it's hyperlinks" is not the way that WO is intended to work (though I have abused it like that myself), so I am unsure what it happening in your code. Is childrenElements() getting populated correctly?
>>>>>>>>>>>
>>>>>>>>>>> Yeah, I'm actually basing this off of AjaxTabbedPanel (which is your component I believe?)
>>>>>>>>>>
>>>>>>>>>> Yes, that was my wilful abuse of WO.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> The HTML output is exactly the way I want so it must be correctly finding the child elements.
>>>>>>>>>>>
>>>>>>>>>>> Just like AjaxTabbedPanel I put the find children function in the constructor.
>>>>>>>>>>>
>>>>>>>>>>> IDK if it helps but the output looks like this:
>>>>>>>>>>>
>>>>>>>>>>> <ul class="footer-navigation"><li><a href="#" data-trigger="contextMenu"data-contextmenu-options = "{'display':'above'}">+</a><ul class="dropdown-menu"><li><a href="/cgi-bin/WebObjects/KMIWebCMSApp_1.woa/-5570/wo/43.0.9.1.13.1.5.1.5">Create New Group</a></li></ul></li></ul>
>>>>>>>>>>>
>>>>>>>>>>> Menu is the outer UL
>>>>>>>>>>> MenuItem is everything inside the first LI
>>>>>>>>>>> And the links are put inside the list items inside the inner UL
>>>>>>>>>>
>>>>>>>>>> I will guess that the .0.9.1.13.1.5.1.5 generated in appendToResponse is not matching the elementID when invokeAction is processed. You are going to have to step through it.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Chuck
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> On Jan 31, 2013, at 12:01 PM, Chuck Hill <email@hidden> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Is Menu calling invokeAction on all of the MenuItem? Are they calling it on all of the hyperlinks.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Chuck
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 2013-01-31, at 1:15 PM, Johnny Miller wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I have some code that looks like this:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> <webobject name = "Menu">
>>>>>>>>>>>>>>> <webobject name = "MenuItem">
>>>>>>>>>>>>>>> <wo:Hyperlink action = "$someAction">Do Stuff</wo:hyperlink>
>>>>>>>>>>>>>>> </webobject>
>>>>>>>>>>>>>>> </webobject>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Menu and MenuItem are two components that subclass ERXDynamicElement
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Basically Menu finds all it's MenuItems and then the MenuItem finds all it's hyperlinks and they are formatted the way I want during the respective appendToResponse phases.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> The HTML looks right but for some reason $someAction doesn't get called when the link is clicked?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Can anyone shed the light on what I'm missing?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Thanks in advance,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Aloha,
>>>>>>>>>>>>>>> Mr. Johnny Miller
>>>>>>>>>>>>>>> Web Development Manager
>>>>>>>>>>>>>>> Kahalawai Media Company
>>>>>>>>>>>>>>> Lahaina, HI 96761
>>>>>>>>>>>>>>> tel: (808) 661-7962 | mobile: (808) 283-0791
>>>>>>>>>>>>>>> website | e-mail
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>>>>>>>>>>> Webobjects-dev mailing list (email@hidden)
>>>>>>>>>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> This email sent to email@hidden
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>> Chuck Hill Senior Consultant / VP Development
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>>>>>>>>>>>>>> http://www.global-village.net/gvc/practical_webobjects
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
>>>>>>>>>>>>>> Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Chuck Hill Senior Consultant / VP Development
>>>>>>>>>>>>
>>>>>>>>>>>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>>>>>>>>>>>> http://www.global-village.net/gvc/practical_webobjects
>>>>>>>>>>>>
>>>>>>>>>>>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
>>>>>>>>>>>> Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Chuck Hill Senior Consultant / VP Development
>>>>>>>>>>
>>>>>>>>>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>>>>>>>>>> http://www.global-village.net/gvc/practical_webobjects
>>>>>>>>>>
>>>>>>>>>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
>>>>>>>>>> Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Chuck Hill Senior Consultant / VP Development
>>>>>>>
>>>>>>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>>>>>>> http://www.global-village.net/gvc/practical_webobjects
>>>>>>>
>>>>>>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
>>>>>>> Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Chuck Hill Senior Consultant / VP Development
>>>>>
>>>>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>>>>> http://www.global-village.net/gvc/practical_webobjects
>>>>>
>>>>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
>>>>> Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>> --
>>> Chuck Hill Senior Consultant / VP Development
>>>
>>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>>> http://www.global-village.net/gvc/practical_webobjects
>>>
>>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
>>> Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>
> --
> Chuck Hill Senior Consultant / VP Development
>
> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/gvc/practical_webobjects
>
> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
> Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
>
>
>
>
>
>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden