How can I get the Column id of a specific row cell index?
HTML table design : My Table
This code handles and Ajax request when the cell content of the table is dropped into another cell:
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"
});
};
};
OK, I will make a scenario to understand what I want.
When a cell content is dropped from one cell to another i'm able to handle the javascript code that it is above.
The next step is to get 3 values parameters to send to my webMethod(SaveCardPosition) in code behind(ASP.Net)
I am able to get the:
CardId(Cell ContentId)
Rowindex where the targetCell belongs(Card_Position)
But I don't know how to get the column id where this targetCell belongs.
How can I achieve this?