daniel_wai
Posts: 13
|
Posted: 02/18/2016, 2:29 AM |
|
I have function written in Common Script section which is try to reload parts of html and bind CodeCharge button event in that parts.
Something like this:
function testReload(){
$('#pnlTest').load(location.href + " #pnlTesttest", function() {
$('*:ccsControl(pnlTest, test, Button_Delete)').ccsBind(function() {
this.bind("click", actions["pnlTesttestButton_DeleteOnClick"]);
});
});
}
and it works gracefully.
But if I create another function which perform similar operation when I clicked a link (html link) and call this function when onclick, it doesn`t work at all! Debugger show error - "Uncaught ReferenceError: actions is not defined"
How can I use these codes?
$('*:ccsControl(pnlTest, test, Button_Delete)').ccsBind(function() {
this.bind("click", actions["pnlTesttestButton_DeleteOnClick"]);
});
|
|
|
eratech
Posts: 513
|
Posted: 02/18/2016, 11:03 PM |
|
Yeah - I've not understood that either. I tried doing similar some months ago without success and eventually just added my own event binding through normal jquery.
I suspect it was something with the way CCS uses some jquery plug-ins of it's own and passes much of the stuff as options to those wrapper functions.
Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia |
|
|
DataDoIT
|
Posted: 02/19/2016, 8:15 PM |
|
Put your code into an event listener, such as your form's Client On
Load. So CodeCharge will set up as such:
<code>
//MyFormOnLoad Event Start @-D6A64671
actions["MyFormOnLoad"] = function (eventType, parameters) {
var result = true;
//End MyFormOnLoad Event Start
//Custom Code @35-2A29BDB7
// -------------------------
//Check to see if the Delete button was clicked:
$('#pnlTesttestButton_Delete').click(function(e){
//Do your thang.
});
//Or maybe you want to do some other things using jQ
//in a CodeCharge event listener:
jQuery(function ($) {
if ($('#MyField').val() == 'Rock and Roll') {
alert('Rock on');
}
});
// -------------------------
//End Custom Code
//MyFormOnLoad Event End @-A5B9ECB8
return result;
};
//End MyFormOnLoad Event End
</code>
|
|
|
eratech
Posts: 513
|
Posted: 02/20/2016, 7:50 PM |
|
Thanks DataDoIT, makes sense now. I guess the other Binds just don't have the scope to see the same event functions, but in the On Load they do.
Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia |
|
|
|