Reputation: 37
I'm trying to set up a toggle so that a user can use a list of objects as a To Do list. I'm looking for a way that a user can click a row, and it will toggle a span from one font-icon to another. I'm also looking to not hit the server at all.
Currently I have this javascript function, which is called by the ClientEvents OnRowClick
event in the ClientSettings portion of my radgrid.
function ToggleMark(sender, eventArgs) {
var spn = eventArgs.get_item().findElement("spnMarker");
if(spn.className == "icon-minus") { spn.className = "icon-checkmark"; }
else { spn.className = "icon-minus"; }
}
It is attached to a grid with this template. The span spnMarker
is the element that I'm interested in.
<rad:GridTemplateColumn UniqueName="ManualMarker" HeaderText="" HeaderStyle-Width="12px" >
<ItemTemplate>
<span id="spnMarker" class="icon-minus" style="font-size:20px;display:inline;"></span>
</ItemTemplate>
</rad:GridTemplateColumn>
This will select and toggle the first element of my grid, but not the element that I click on specifically. I was originally messing around with get_itemIndexHierarchical()
to select it from a listing of all of the items, but I must have been doing that wrong, since I got the same behavior.
Upvotes: 0
Views: 1143
Reputation: 5603
This shows how you can get a cell by a concrete column: http://www.telerik.com/help/aspnet-ajax/grid-getting-cell-values-for-selected-rows-client-side.html
Upvotes: 1