Another XBL Event Handling Issue (using old XBL scoping rules)

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Another XBL Event Handling Issue (using old XBL scoping rules)

Philip.Cantin
Hi All,

I have a datatable that uses the <fr:inplace-input> component. In addition, I have a button 'New' that, when clicked, creates a new row in the datatable, and thus a new <fr:inplace-input> component within the row.

I would like to find a way to, upon clicking 'New', automatically have the newly added row activate its <fr:inplace-input> component, so the user doesn't have to click twice to edit the new field.

To solve this, I decided to take the XBL event-handling approach with <xforms:dispatch> statements. Here is an abstract representation of what my code looks like:


<fr:datatable id="my-datatable">
...
   <xforms:repeat id="dt-repeat">
      <fr:inplace-input id="my-input">
         <xf:hint>Click here to edit</xf:hint>
      </fr:inplace-input>
   </xforms:repeat>

   <xforms:trigger>
      <xf:label>New</xf:label>
      <xf:insert ... />
      <xf:dispatch ev:event="DOMActivate" name="inplace-input-focus1" targetid="my-datatable" />
   </xforms:trigger>
...
</fr:datatable>


I dispatch an event to 'my-datatable' first, and then from 'my-datatable' to 'my-input'. The problem lies in the fact that the <fr:inplace-input> component is within a repeat statement, and since ids for all repeated <fr:inplace-input> components are the same, the event always dispatches to the first component. Instead, I would like to have it dispatch to the newly created component.

Is there a way to do this? I had thought about using XSLT to create unique ids but I was wondering if there was another way. I am definitely aware of the new XBL scoping rules being implemented in future builds, but I wanted to have this as sort of a "temporary fix".

Any help would be greatly appreciated!!


---Philip
Reply | Threaded
Open this post in threaded view
|

Re: Another XBL Event Handling Issue (using old XBL scoping rules)

Alessandro  Vernet
Administrator
Philip,

On Wed, Nov 11, 2009 at 10:42 AM, Philip.Cantin <[hidden email]> wrote:
> I have a datatable that uses the <fr:inplace-input> component. In addition,
> I have a button 'New' that, when clicked, creates a new row in the
> datatable, and thus a new <fr:inplace-input> component within the row.

To set the current iteration in the repeat to the one you just
inserted you can use an <xforms:setindex>. You can see this in action
in this example: http://pastie.org/694243.

Now, for some reason, when setting the index to the 3rd iteration, the
fr:datatable highlights the 4th one. I created a bug for this:

http://forge.ow2.org/tracker/index.php?func=detail&aid=314465&group_id=168&atid=350207

In the meantime, you can disable the highlighting of the current row
by overriding the CSS for ".yui-skin-sam tr.yui-dt-selected td"
defined in datatable.css.

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Another XBL Event Handling Issue (using old XBL scoping rules)

Philip.Cantin
Alex,

I did what you suggested with the <xforms:setindex> statement, but it doesn't seem to be working for me, or perhaps maybe I've missed something.

I've attached a simple example to this message to illustrate my problem, by slightly modifying the Pastie example you linked me to earlier.

To reproduce:

1) Download attached ZIP file. Place 'datatable.xbl' in the orbeon-resources-private.jar file under /xbl/orbeon/datatable, and place 'inplace-input.xbl' in the orbeon-resources-private.jar file under /xbl/orbeon/inplace-input.

2) Place folder in the apps directory, and run.

3) Click 'Add Row'. Notice how, in test.xhtml, even though I have an <xforms:setindex> statement that says:

<xforms:setindex repeat="record-repeat" index="4"/> ,

the inplace-input component for the FIRST row is activated, not the newly inserted row.


Thanks in advance for your help! :)


---Philip


xforms-datatable-test.zip

Alessandro Vernet-2 wrote
Philip,

On Wed, Nov 11, 2009 at 10:42 AM, Philip.Cantin <pjcantin@gmail.com> wrote:
> I have a datatable that uses the <fr:inplace-input> component. In addition,
> I have a button 'New' that, when clicked, creates a new row in the
> datatable, and thus a new <fr:inplace-input> component within the row.

To set the current iteration in the repeat to the one you just
inserted you can use an <xforms:setindex>. You can see this in action
in this example: http://pastie.org/694243.

Now, for some reason, when setting the index to the 3rd iteration, the
fr:datatable highlights the 4th one. I created a bug for this:

http://forge.ow2.org/tracker/index.php?func=detail&aid=314465&group_id=168&atid=350207

In the meantime, you can disable the highlighting of the current row
by overriding the CSS for ".yui-skin-sam tr.yui-dt-selected td"
defined in datatable.css.

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Another XBL Event Handling Issue (using old XBL scoping rules)

Alessandro  Vernet
Administrator
Philip,

On Thu, Nov 12, 2009 at 1:29 PM, Philip.Cantin <[hidden email]> wrote:
> 1) Download attached ZIP file. Place 'datatable.xbl' in the
> orbeon-resources-private.jar file under /xbl/orbeon/datatable, and place
> 'inplace-input.xbl' in the orbeon-resources-private.jar file under
> /xbl/orbeon/inplace-input.

You don't need this step. Those files will be automatically loaded
from the jar files, and you only to extract them if you want to
override them with your own version.

> the inplace-input component for the FIRST row is activated, not the newly
> inserted row.

Here is what I see on Firefox: http://screencast.com/t/MzM5YTBlYTIt

This doesn't seem to match what you describe, and also I don't quite
understand how the in-place editor could get the focus. Do you want it
to switch to "edit" mode?

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Another XBL Event Handling Issue (using old XBL scoping rules)

Philip.Cantin
Alex,

Alessandro Vernet-2 wrote
You don't need this step. Those files will be automatically loaded
from the jar files, and you only to extract them if you want to
override them with your own version.
Okay, well I had intended to override those files in the original JAR with my own versions of them. That's why I included them in the attached ZIP; there's an <xforms:dispatch> statement that is supposed to send an event to the <fr:datatable> component, and the <fr:datatable> component will send an event to the <fr:inplace-input> component.


Alessandro Vernet-2 wrote
 I don't quite
understand how the in-place editor could get the focus. Do you want it
to switch to "edit" mode?
Yes! This is my ultimate goal. Upon click of the 'Add Row' button, I'd like the newly inserted row to switch to "edit" mode. Is there a simpler approach I could take to achieve this, instead of XBL events?



---Philip

--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws


Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Another XBL Event Handling Issue (using old XBL scoping rules)

Alessandro  Vernet
Administrator
Philip,

On Fri, Nov 13, 2009 at 7:34 AM, Philip.Cantin <[hidden email]> wrote:
> Okay, well I had intended to override those files in the original JAR with
> my own versions of them. That's why I included them in the attached ZIP;
> there's an <xforms:dispatch> statement that is supposed to send an event to
> the <fr:datatable> component, and the <fr:datatable> component will send an
> event to the <fr:inplace-input> component.

OK, understood. I didn't realized you had changes to those files.

> Yes! This is my ultimate goal. Upon click of the 'Add Row' button, I'd like
> the newly inserted row to switch to "edit" mode. Is there a simpler approach
> I could take to achieve this, instead of XBL events?

OK, so just using xforms:setfocus won't be enough. In addition you'll
have to tell the fr:inplace-input to switch to "edit" mode. For this,
I would add an event on the fr:inplace-input that toggles it to edit
mode. Maybe the syntax could be:

<xforms:dispatch target="my-inplace-edit" name="fr-toggle">
    <xxforms:context name="fr-case">edit</xxforms:context>
</xforms:dispatch>

For this you'll have to implement this new event in the
inplace-input.xbl. I don't know if you have done this already in the
past, but you can at accordion.xbl which handles events it gets from
the "outside world".

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Another XBL Event Handling Issue (using old XBL scoping rules)

Philip.Cantin
Alex,

Alessandro Vernet-2 wrote
For this you'll have to implement this new event in the
inplace-input.xbl. I don't know if you have done this already in the
past, but you can at accordion.xbl which handles events it gets from
the "outside world".
Yes, actually I have already implemented the XBL event handlers with the inplace-input.xbl and datatable.xbl files that I attached in the ZIP. :) I'll attach it again just in case.

The problem is, even with the new event handlers that are in the modified versions of those files, it's not the newly inserted row that automatically switches to "edit" mode...it's always the first row. Even with the <xforms:setindex> statement within test.xhtml. And this is my main problem right now.

Do you have an idea what could be the problem with my code?


---Philip


xforms-datatable-test.zip


Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Another XBL Event Handling Issue (using old XBL scoping rules)

Alessandro  Vernet
Administrator
Philip,

On Mon, Nov 16, 2009 at 7:19 AM, Philip.Cantin <[hidden email]> wrote:
> Yes, actually I have already implemented the XBL event handlers with the
> inplace-input.xbl and datatable.xbl files that I attached in the ZIP. :)
> I'll attach it again just in case.
>
> The problem is, even with the new event handlers that are in the modified
> versions of those files, it's not the newly inserted row that automatically
> switches to "edit" mode...it's always the first row. Even with the
> <xforms:setindex> statement within test.xhtml. And this is my main problem
> right now.

This tells you one thing: that I read your message too quickly. Or
rather, maybe, that this Bordeaux I'm having is quite good. Sorry
about that! Back to business: your version of inplace-input.xbl loads
/datatables_with_autocomplete_values.xml, which I don't have. Also,
can you reproduce this without the datatable: with a regular table and
an xforms:repeat?

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Another XBL Event Handling Issue (using old XBL scoping rules)

Philip.Cantin
Alex,


Alessandro Vernet-2 wrote
This tells you one thing: that I read your message too quickly. Or
rather, maybe, that this Bordeaux I'm having is quite good. Sorry
about that!
Not a problem at all. A lot of programmers I know like to drink beer; good to see one that appreciates fine wine ;)

Alessandro Vernet-2 wrote
Back to business: your version of inplace-input.xbl loads
/datatables_with_autocomplete_values.xml, which I don't have.
Ah, I had forgotten about those changes. The inplace-input.xbl I have in the attached ZIP is much closer to the one in the nightly builds, with only the event handling changes.

Alessandro Vernet-2 wrote
Also, can you reproduce this without the datatable: with a regular table and
an xforms:repeat?
I tried getting the same error without the datatable, and surprisingly....I cannot. If you try the following:

1) Download xforms-datatable-test2.zip to the apps folder and place the modified inplace-input.xbl in orbeon-resources-public.jar.
2) Run application, and click 'Add Row'

You'll notice that the event dispatches to the correct fr-inplace-input component.

I also tried running the code from earlier (that included the datatable), using the modified inplace-input.xbl, and it still did not go to the correct row.

Attached is the modified application so you can see the results for yourself. Could this be a bug?


---Philip


xforms-datatable-test2.zip
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Another XBL Event Handling Issue (using old XBL scoping rules)

Philip.Cantin
Alex,

I was just wondering if you had a chance to look at the reproducible sample. Plus a few quick questions:

About the fact that switching to edit mode works in regular tables but not in fr:datatables: is this related to the datatable highlighting bug you mentioned earlier?

And is there a possibility this may be fixed in the short term?


Thanks!

---Philip
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Another XBL Event Handling Issue (using old XBL scoping rules)

Erik Bruchez
Administrator
Hi Philip,

Alex is on vacation for a couple of weeks. I will try to run your sample soon!

-Erik

On Mon, Nov 23, 2009 at 2:57 PM, Philip.Cantin <[hidden email]> wrote:

>
> Alex,
>
> I was just wondering if you had a chance to look at the reproducible sample.
> Plus a few quick questions:
>
> About the fact that switching to edit mode works in regular tables but not
> in fr:datatables: is this related to the datatable highlighting bug you
> mentioned earlier?
>
> And is there a possibility this may be fixed in the short term?
>
>
> Thanks!
>
> ---Philip
> --
> View this message in context: http://n4.nabble.com/Another-XBL-Event-Handling-Issue-using-old-XBL-scoping-rules-tp586009p786433.html
> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Another XBL Event Handling Issue (using old XBL scoping rules)

Erik Bruchez
Administrator
Philip,

Just noticed that this thread has not been updated. Are your issues
still current?

-Erik

On Tue, Nov 24, 2009 at 11:44 AM, Erik Bruchez <[hidden email]> wrote:

> Hi Philip,
>
> Alex is on vacation for a couple of weeks. I will try to run your sample soon!
>
> -Erik
>
> On Mon, Nov 23, 2009 at 2:57 PM, Philip.Cantin <[hidden email]> wrote:
>>
>> Alex,
>>
>> I was just wondering if you had a chance to look at the reproducible sample.
>> Plus a few quick questions:
>>
>> About the fact that switching to edit mode works in regular tables but not
>> in fr:datatables: is this related to the datatable highlighting bug you
>> mentioned earlier?
>>
>> And is there a possibility this may be fixed in the short term?
>>
>>
>> Thanks!
>>
>> ---Philip
>> --
>> View this message in context: http://n4.nabble.com/Another-XBL-Event-Handling-Issue-using-old-XBL-scoping-rules-tp586009p786433.html
>> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>>
>>
>> --
>> You receive this message as a subscriber of the [hidden email] mailing list.
>> To unsubscribe: mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>
>>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws