Behaviors in listGrid

Hi all,
do behaviors works in listGrid components?
I've tried to associate the following behavior:

<d:behavior name="submitOnBlur">
        <d:handler event="blur" type="application/javascript">
                bb.bjsf.sync(this,'custom');
        </d:handler>
</d:behavior>

to a listGrid and doesn't works, but if the same behavior is assciated to a inputText does.

Regards
David

Focus and listGrid

Yes, it should be possible to apply behaviours to a listGrid. However, the listGrid does not support focus/blur (i.e. it does not inherit from b:focusableElement) and so the blur event never gets fired. Form elements, such as b:button and b:calendar, do support the focus model.

and dblclick and keydown?

I did the same with a behavior with an event keydown and dblclick and I get the error anyway. The error is "Behavior m:closeValueList was not found", however this behavior is defined in m.xml as follows:

<d:behavior name="closeValueList">
        <d:handler event="dblclick" type="application/javascript">
                // Some code...                
        </d:handler>
        <d:handler event="keydown" type="text/javascript">
                // Some code...
        </d:handler>
</d:behavior>

I have associated it to the listGrid with this sentence:

listGrid.setBehavior("m:closeValueList");

and the generated BTL code is:

<listGrid ... e:behavior="m:closeValueList" ...>

Do you see something wrong?
Thanks
David

Namespace defined?

David,
What is the namespace for the behavior?
The d:behavior needs to be wrapped in d:tdl and d:namespace to be valid.
Your namespace then needs to be associated with the m: prefix by using xmlns:m="...your namespace here.."

The definition of behavior has changed a bit from v3 to v4 in case that is causing confusion. In v3 you could define a behavior anywhere with s:behavior.
Now you must use the d:behavior inside d:namespace inside d:tdl.

Namespace

Hi Richard,
In the m.xml the behavior node is enclosed inside a tag :

<d:namespace name="http://www.mycompany.com">

There are another behavior (linked to an inputText in the jsp) in the same namespace and this behavior works fine.
To relate the namespace I have the following code:
<bjsf:application id="main" skin="myskin" clientDebug="true"
                        nsMap="m,http://www.mycompany.com">

<xi:include href="../behaviors/m.xml"/>

I think that's all what I need, right?

David

How to register my namespace

Hi again,
I've found the problem but not the solution.
When my code is executed and I generate the listGrid this is the xml sent to the client:

<?xml version="1.0" encoding="UTF-8"?><e:script xmlns="http://www.w3.org/1999/xhtml" xmlns:e="http://www.backbase.com/2006/xel" xmlns:b="http://www.backbase.com/2006/btl" xmlns:c="http://www.backbase.com/2006/command" xmlns:bjsfc="http://www.backbase.com/2007/jsf/client" xmlns:xi="http://www.w3.org/2001/XInclude"><c:create xmlns:b="http://www.backbase.com/2006/btl" xmlns:e="http://www.backbase.com/2006/xel" destination="id('valueListPanel')" mode="replaceChildren">
My view code is here....
</c:create><e:return /></e:script>

As you can see, all the namespaces from Backbase are declared but mine doesn't.
How can I register my namespace for that request?
I've registered it into the nsMap attrib. from the <bjsf:application> node.

Could you help me, please?
David

Using listGrid's behavior attribute

Hi David,
You can have the proper result by using the listGrid Backbase JSF component attribute "behavior"

Assuming you have your behavior defined in a file behavior.xml like this:

<d:tdl xmlns:d="http://www.backbase.com/2006/tdl"  >
<d:namespace name="http://myCompany.com/">
<d:behavior name="bbb">
<d:handler event="mousedown" type="text/javascript">
alert('This is my behavior');
</d:handler>
</d:behavior>

You can attach this behavior to the JSF listGrid component like this:

<bjsf:application nsMap="custom,http://myCompany.com/" >
       
<xi:include href="behavior.xml" />

<bjsf:listGrid behavior="custom:bbb" ...>
...
</bjsf:listGrid>

</bjsf:application>

dynamic loading

Hi again Dimitra,
You've replied me at another post about something similar. The problem that I'm facing is about pages loaded dynamically. In this loadings the namespaces defined at the bjsf:application level are not present.
You gave me two solutions to define the namespace inline in the client BTL components but I still have the same problems with the JSF components.

listGrid = new UIBackbaseListGrid();
listGrid.setId("vlGrid");
listGrid.setBehavior("mapfre:closeValueList");

In this code I create a listGrid dynamically and add it to a panel. The response is posted above, where the namespace is not defined.
I've tried to use your solutions in this approach but here I can't wrap the listgrid inside a  <div "xmlns:mapfre=http:www.mapfre.com"> and I can't define the namespace inline.
any suggestion?
Thank you Dimitra
david

David

you are right in this. I have entered a bug in our system to add this feature.
You should have more flexibility to register custom namespaces to the response.

So far have not been able to find a workaround for you for this use case.

Dimitra

OK

OK Dinmitra,
I'll be expected for new versions.
Thanks a lot
david

I suggest behaviors don't

I suggest behaviors don't works in listGrid this way...