5 Answers, 1 is accepted
0
Hello David,
You are trying to use an approach that is applicable only with server data binding. If you are using client-side binding, please hide the buttons with Javascript in the Grid's dataBound event handler.
All the best,
Dimo
the Telerik team
You are trying to use an approach that is applicable only with server data binding. If you are using client-side binding, please hide the buttons with Javascript in the Grid's dataBound event handler.
All the best,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David A.
Top achievements
Rank 1
answered on 21 Sep 2012, 08:20 PM
Hi Dimo,
Thanks for your response but I couldn't find any substantial documentation on the dataBound event. Not sure if this is the best way to do it, but I ended up creating a template and it works fine.
David A.
Thanks for your response but I couldn't find any substantial documentation on the dataBound event. Not sure if this is the best way to do it, but I ended up creating a template and it works fine.
David A.
c.Template(@<
text
></
text
>).ClientTemplate(@"
<
a
style
=
""
margin-left: 5px;""
class
=
""
k-button k-button-icontext k-grid-edit""
href
=
""
\#""><
span
class
=
""
k-icon k-edit""></
span
>Edit</
a
>
# if (TownshipsReceived==0) { #
<
a
style
=
""
margin-left: 5px;""
class
=
""
k-button k-button-icontext k-grid-delete""
href
=
""
\#""><
span
class
=
""
k-icon k-delete""></
span
>Delete</
a
>
# } #").Width(180);
0
Daniel
Top achievements
Rank 2
answered on 01 Oct 2012, 12:16 PM
Hi,
I use the said method
Like:
I use the said method
Like:
function
onDataBound(e) {
var
data =
this
._data;
for
(
var
x = 0; x < data.length; x++)
{
var
dataItem = data[x];
if
(dataItem.HasMembers)
{
var
tr = $(
"#Affiliate"
).find(
"[data-uid='"
+ dataItem.uid +
"']"
);
tr.find(
'a.k-grid-delete'
).remove();
}
}
}
the problem is that if I enter editmode and the cancel that edit the delete button reapperas.
Best Regards
Daniel
0
Hello Daniel,
Indeed, the delete button reappears, because the Grid is not aware of the customization that you have made. You can attach a click handler to the "Cancel" button in the Grid's edit event and remove the "Delete" button again by using setTimeout.
Regards,
Dimo
the Telerik team
Indeed, the delete button reappears, because the Grid is not aware of the customization that you have made. You can attach a click handler to the "Cancel" button in the Grid's edit event and remove the "Delete" button again by using setTimeout.
.Events(ev => ev.DataBound(
"onDataBound"
).Edit(
"attachRemove"
))
function
attachRemove(e) {
var
idx = e.container.index(),
parent = e.container.parent();
e.container.find(
".k-grid-cancel"
).click(
function
() {
window.setTimeout(
function
(){
parent.children().eq(idx).find(
'a.k-grid-delete'
).remove();
}, 1);
});
}
Regards,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniel
Top achievements
Rank 2
answered on 03 Oct 2012, 08:33 AM
Thanks,
works perfectly, you saved my day.
Best Regards
Daniel
works perfectly, you saved my day.
Best Regards
Daniel