How does one change the text of the 'Cancel' option in Actionsheet?
The documentation states that there is an actionsheet configuration parameter of 'cancel', but gives no example how to apply such configurations. Is there some sort of actionsheet object that is supposed to be instantiated to do this?
Thanks in advance
The documentation states that there is an actionsheet configuration parameter of 'cancel', but gives no example how to apply such configurations. Is there some sort of actionsheet object that is supposed to be instantiated to do this?
Thanks in advance
5 Answers, 1 is accepted
0
Hello John,
Yes it is possible to change the default text of the cancel button through the cancel option.
In order to apply the configuration you could use either the data-cancel attribute in the markup or to define the cancel property in the jQuery syntax initialization. For example:
I hope this helps.
Regards,
Alexander Valchev
the Telerik team
Yes it is possible to change the default text of the cancel button through the cancel option.
In order to apply the configuration you could use either the data-cancel attribute in the markup or to define the cancel property in the jQuery syntax initialization. For example:
<
ul
id
=
"inboxActions"
data-role
=
"actionsheet"
data-open
=
"onOpen"
data-popup
=
'{"direction": "left"}'
data-cancel
=
"custom cancel text"
>
<
li
class
=
"km-actionsheet-title"
>Monday Meeting:</
li
>
<
li
><
a
href
=
"#"
data-action
=
"reply"
>Reply</
a
></
li
>
<
li
><
a
href
=
"#"
data-action
=
"replyAll"
>Reply All</
a
></
li
>
<
li
><
a
href
=
"#"
data-action
=
"archive"
>Archive</
a
></
li
>
</
ul
>
//in the view init event handler
$(
"#inboxActions"
).kendoMobileActionSheet({
//.....
cancel:
"custom cancel text"
});
I hope this helps.
Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
John
Top achievements
Rank 1
answered on 10 Jul 2012, 06:54 PM
Is there a way to pass a function into the data-cancel attribute?
I tried the following:
data-cancel="myFunction()"
and data-cancel=myFunction()
But as you may guess, it outputs the literal string "myFunction()". Are passing functions in any way possible?
I tried the following:
data-cancel="myFunction()"
and data-cancel=myFunction()
But as you may guess, it outputs the literal string "myFunction()". Are passing functions in any way possible?
0
Hello John,
I am afraid that this is not supported - you cannot change the default action of the cancel button.
As a general information, when you want to pass a function via data attribute in KendoMobile you should not add the brackets, but only the name of the function. For example:
Regards,
Alexander Valchev
the Telerik team
I am afraid that this is not supported - you cannot change the default action of the cancel button.
As a general information, when you want to pass a function via data attribute in KendoMobile you should not add the brackets, but only the name of the function. For example:
<li><a href=
"#"
data-action=
"reply"
>Reply</a></li>
function
reply(e) {
//do something
}
Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
John
Top achievements
Rank 1
answered on 13 Jul 2012, 12:33 PM
Sorry, I should have been more specific. The function that I want to specify in the data-cancel attribute is to purely return a string that will act as the text of the cancel button.
For example, If I want my cancel-text to say "Close", hard coding it would look like this:
data-cancel="Close"
But If I don't want to hard code it and I want the string to come from a function, I would think to do this:
data-cancel=getString()
where myFunction() returns the string "Close".
Is this in any way possible?
Thanks again,
John
For example, If I want my cancel-text to say "Close", hard coding it would look like this:
data-cancel="Close"
But If I don't want to hard code it and I want the string to come from a function, I would think to do this:
data-cancel=getString()
where myFunction() returns the string "Close".
Is this in any way possible?
Thanks again,
John
0
Accepted
Hi John,
Thank you for the clarification, however this is not supported either. The cancel attribute cannot be a function, it accepts only a string.
If you wish you can init the actionsheet through jQuery plug in syntax - this will allow you to use a variable instead of string.
Regards,
Alexander Valchev
the Telerik team
Thank you for the clarification, however this is not supported either. The cancel attribute cannot be a function, it accepts only a string.
If you wish you can init the actionsheet through jQuery plug in syntax - this will allow you to use a variable instead of string.
function
actionsheetInit() {
$(
"#inboxActions"
).kendoMobileActionSheet({
cancel: cancelStringVar,
popup: {direction:
"left"
}
});
}
Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!