2014-01-28 100 views

回答

0

您不需要为此使用JQuery,因为您需要的所有功能都由Telerik客户端API提供。我将开始通过将客户端事件处理程序到您的RadGrid通过添加类似下面的标记:

<ClientEvents OnRowSelected="jsRowSelected" /> 

适用的Telerik documentation然后可以用来确定你传递什么样的数据来简化这一过程中,这种情况下,gridDataItem从这里可以(希望)操纵一行如下:

function jsRowSelected(sender, eventArgs) { 
    var cell = eventArgs.gridDataItem.get_cell("chkSelect"); // use the name of your column here 
    var ctrls = cell.getElementsByTagName('input'); 
    if (ctrls .length > 0) { 
     ctrls[0].checked = true; // I've got it setting the value to "checked" but you might want to do something else 
    } 
} 

我没有语法错误或检查上述错误所以在(可能)的事件,它不起作用了以下功能可以用来获得所需的物品:get_selectedItems我来自网格MasterTableView(请参阅this guide)的步骤允许您获取选定的数据项;从选定的行中,您可以使用getCellByColumnUniqueName方法导航到列。在这里,您可以使用上面使用的findControl(请参阅this guide)或前面提到的getElementsByTagName(查找input元素)来查找复选框控件并更新其状态。