Here's the scenario, I have a grid (i'm using MVC wrapper to create it, but the problem is on the client so this forum should be ok...), the grid is setup for editing in popup mode. On the databound event, I have some script that alters the buttons to use my own icons rather than the default and it removes any text in the buttons as well.
This is made necessary since there is no way to customize the button's html.
Here's the script that runs on the databound event:
The above script works great, it displays exactly like i want it to. The details button is a custom button, while the edit and delete are the default output of the MVC wrapper for those commands. The problem starts when I complete an edit, rather when i click the "Update" or "Cancel" button on the popup. For some reason, the buttons switch back to thier original state with the original icons and text.
I've tried binding to the click events of the update and cancel, but the change is occuring after that event. I've tried binding to the DOMNodeInserted/DOMNodeRemoved events but I cannot seem to get those events to bind or fire consistently across all browsers or all situations.
Any ideas on how to prevent the buttons from changing back to thier original state? Any help would be appreciated.
This is made necessary since there is no way to customize the button's html.
Here's the script that runs on the databound event:
function
updateGridButtons() {
$(
".k-grid-Details"
)
.each(
function
() { styleGridButton(
this
,
"View Details"
,
"e-icon-viewDetails"
); });
$(
".k-grid-edit"
)
.each(
function
() { styleGridButton(
this
,
"Edit"
,
"e-icon-customEdit"
); });
$(
".k-grid-delete"
)
.each(
function
() { styleGridButton(
this
,
"Delete"
,
"e-icon-customDelete"
); });
}
function
styleGridButton(button, title, icon) {
$(button)
.removeClass(
"k-button-icontext"
)
.addClass(
"k-button-icon"
)
.attr(
"title"
, title)
.html(
"<span class=\"k-icon "
+ icon +
"\"></span>"
);
}
I've tried binding to the click events of the update and cancel, but the change is occuring after that event. I've tried binding to the DOMNodeInserted/DOMNodeRemoved events but I cannot seem to get those events to bind or fire consistently across all browsers or all situations.
Any ideas on how to prevent the buttons from changing back to thier original state? Any help would be appreciated.