PDA

View Full Version : [CLOSED] What is a delegate Event Binding vs standard event binding?



jimibt
4 Oct 2012, 1:16 AM
REQUIRED INFORMATION Architect Build tested:

Build: 640

Project Type:


Touch 2.x

Description:

When I add a delegate to a List in a View, I get a double delegate ID appearing in the listeners[] array.

Steps to reproduce the problem:

Create a new touch 2 project
From the Views treeview, add a Container (just keep the default name - MyContainer)
Next, add a List to the container (keep default name - mylist)
Now, add an event binding of type delegate to mylist
Choose the type as Ext.dataview.List
Edit the binding and name the delegate MyList (notice the change of naming to differentiate)
Under EventBinding->name, select 'disclose'
Now view the resulting code in Code view

The result that was expected:

Expected to see the listeners[] section populated with a delegate called delegate: '#mylist'

The result that occurs instead:

The listener delegate is creating a strange double entry name of delegate: '#mylist MyList'

Possible fix:

the only fix was to edit the View .js file manually to remove the double barrelled entry and name it correctly. I have to do this everytime I deploy as it reappears on opening up the project again. Removing the property value from the metadata resulted in either an error, or if a null string was applied, it gave an delegate: '#mylist ' (i.e. with a space.)
I've not tested this with other types of controls but I believe it's probably widespread across all additions of delegate Event Bindings, therefore a serious bug

Operating System:

Windows 7 Ultimate

Further Request info
Would you also be able to let me know how I can use refs inside the controller config in order to use in the following manner:

config: {
refs: {
notesListView: 'noteslistview'
},
control: {
notesListView: {
newNoteCommand: 'onNewNoteCommand'
}
}
}

I'm unable to set the control notesListView {} to reference the refs{} section nad have to instead 'hardcode' the notesListView as per:

control: {
"noteslistview": {
newNoteCommand: 'onNewNoteCommand'
}
}

Sorry to mix/match this wil a bug element but I feel that this could also be a bug -the fact that I can't refernece a variable in the control section 'easily'.

Phil.Strong
9 Oct 2012, 10:43 AM
The issue is that a delegate event binding uses CQ to delegate an event to another observable within this component. Which means that if you want to delegate an event to mylist it would have to be an event that fired on it's parent or above. When you add a delegate event binding to a child component we give it an itemId and prefix your delegate query w/ it. Scoping it correctly.

In a nut shell, in this case you should be using an event binding and not a delegate event binding as you don't need to delegate anything here.

jimibt
22 Oct 2012, 3:53 AM
ok, gotcha, guess it was my misunderstanding of the hierarchy.

thanks for that
jim