如何获取特定行单元格索引的列 ID?
HTML表格设计:我的表格
当表格的单元格内容被放入另一个单元格时,此代码处理和 Ajax 请求:
redipsInit = function () {
// reference to the REDIPS.drag lib
var rd = REDIPS.drag;
// initialization
rd.init();
// dragged elements can be placed to the empty cells only
rd.dropMode = 'single';
// define dropped handler
//the parameter targetCell is the reference of the cell where the content has been
//dropped
rd.event.dropped = function (targetCell) {
var tbl = rd.findParent('TABLE', targetCell); //reference to my table
//getting the tabindex attribute that in my case represent the row index
var cardPosition = targetCell.attributes[0].value;
// the cell content (the div tag with class = "drag t1") has an ID that reprensents
// the content ID in my DB.
var cardIdBeingDragged = targetCell.firstElementChild.id;
var columnID = "";
var parametros = {
"Card_Position": cardPosition,
"Card_ID": cardIdBeingDragged,
"Column_ID" : ??? // still dont know how to get it.
};
$.ajax({
type: 'POST',
url: "../../Contenido/Board.aspx/SaveCardPosition",
data: JSON.stringify(parametros),
contentType: "application/json; charset=utf-8",
dataType: "json"
});
};
};
好的,我会做一个场景来理解我想要什么。
当单元格内容从一个单元格拖放到另一个单元格时,我能够处理它上面的 javascript 代码。
下一步是在代码后面(ASP.Net)中获取 3 个值参数以发送到我的 webMethod(SaveCardPosition)
我能够得到:
CardId(Cell ContentId)
targetCell 所属的 Rowindex(Card_Position)
但我不知道如何获取此 targetCell 所属的列 ID。
我怎样才能做到这一点?