Opened 11 years ago
Closed 11 years ago
#11628 closed bug (invalid)
ID selector not working immediately after append
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | misc | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I tried to fetch newly appended row to my table and change its content, it seems that the object which I have selected is somehow different from the object appended. limiting the search boundary solved the problem (the ID is guaranteed to be unique):
table is jquery object containing a table object
below is not working
var currentRowID = "monitoringDataRow"+(++sequenceGen); var tr = "<tr id='"+currentRowID+"'></tr>" if(oldRows.rows.length == 0)
table.append(tr);
var jrow = $("#"+currentRowID); jrow.html("<td style='width:150px'>"+row.displayName+"</td><td style='width:150px'>"+row.lastDateTime+"</td><td>"+ProcessLastAction(row.lastAction, currentRowID)+"</td>");
the content do not change although the row is appended (an empty row).
below is working
var currentRowID = "monitoringDataRow"+(++sequenceGen); var tr = "<tr id='"+currentRowID+"'></tr>" if(oldRows.rows.length == 0)
table.append(tr);
var jrow = table.find("#"+currentRowID); jrow.html("<td style='width:150px'>"+row.displayName+"</td><td style='width:150px'>"+row.lastDateTime+"</td><td>"+ProcessLastAction(row.lastAction, currentRowID)+"</td>");
the content do not change although the row is appended (an empty row)
Change History (4)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Owner: | set to [email protected]… |
---|---|
Priority: | undecided → low |
Status: | new → pending |
Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.
Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.
comment:3 Changed 11 years ago by
Status: | pending → new |
---|
sorry for submitting this ticket!
It seems that it was my own mistake. to tell more about the condition were this was happening here is the scenario:
1-I had a table where in 2sec intervals, some rows where removed and where replaced by new ones.
2-later I added a feature by which some of these rows could contain a sub-table
3-this was the root of the problem! my new row was added to main table and all sub-tables! and when I tried selecting the row using rowID it jQuery was returning the row which was located in sub-tables.
Due to strict timing and the idea of "selecting by rowID will give me what I want" I was not able to find my mistake ;)
thank you again
comment:4 Changed 11 years ago by
Component: | unfiled → misc |
---|---|
Resolution: | → invalid |
Status: | new → closed |
the last line of my bug report is pasted incorrectly. it should be :
it works fine!
sorry for the copy-paste mistake