Jump to content

ClientEvents at runtime


Wicket

Recommended Posts

Hi,

 

On the create of all of my forms I have a function which loops over controls to find all UniDBGrids, so I can have one function that sets up the grids, so they are all the same.

 

Is it possible to hook up ClientEvents at runtime, eg

 

AGrid.ClientEvents.UniEvents := xxx

 

I want to be able to hook up to Ext.toolbar.Paging [pagingBar]

 

function pagingBar.afterCreate(sender)
{
    sender.items.items[10].hide(); //hide refresh button
}
 
This will allow me to add this in one place, rather than 50 odd forms.
 
Is this possible?
 
Link to comment
Share on other sites

**edit ignore this post - posted in haste**

 

I have just seen the client demo - UniEdit1.ClientEvents.ExtEvents.Values['change']:='function(sender, newValue){UniClientEventsDynamicClient.UniEdit2.setValue(newValue)}';

 

if anyone does come across this I can confirm this works,

 

AGrid.ClientEvents.UniEvents.Values['pagingBar.afterCreate']:='function pagingBar.afterCreate(sender){sender.items.items[10].hide();}';

Link to comment
Share on other sites

Hi,

I dinamically create components TuniButton, and set "resize" function:

 

TuniButton (NewComponent).ClientEvents.ExtEvents.Values['resize'] := 'function resize(sender, width, height, oldWidth, oldHeight, eOpts)'
                        + '{'
                        + '    var me = sender.btnInnerEl;'
                        + '    var tm = new Ext.util.TextMetrics();'
                        + '    var lineHeight = parseInt(me.getStyle("line-height"));'
                        + '    if (tm.getSize(sender.text).width >= width + 10)'
                        + '    {'
                        + '      Ext.defer(function() {'
                        + '          me.setStyle("line-height", lineHeight / 2 + "px");'
                        + '          me.setStyle("white-space", "normal");'
                        + '      }, 50);'
                        + '    }'
                        + '    else'
                        + '    {'
                        + '      me.setStyle("white-space", "nowrap");'
                        + '    };'
                        + '}';
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...