| Page 1 of 1 | [ 8 posts ] |
|
Hi,
Requirement :- The webpage has a popup which contains yui datatable. The datatable records(data) would depend on the the popup caller. On the yui datable there should be a removable cell for each row that removes the row once clicked. My solution: Hence I have defined the yui data table once and I am using dataTable.getDataSource().sendRequest to generate run time request and change the data. While defining the data table , its is subscribed to all events. Issue: The data is generated and shown as per the requirement. But all the events including delete/remove works only for the 1st time dat table is created. From the second time theres is no js error but the events does not fire. Datatable defination Code: Code: var TestTableconfig = function(aiConfig) { var oRequestBuilderPrAct = function(oState, oSelf) { var dmID = aiDM; return "&dmID="+dmID; }; aiConfig = { initialRequest : oRequestBuilderPrAct(), generateRequest : oRequestBuilderPrAct, dynamicData: true }; var aiColumnDefs = [ {key:"removeAI", label: "Delete", sortable:true,resizeable:true,className: 'removableRecord'}, {key:"testTableDesc",label: "Test Item", sortable:true, resizeable:true,className: 'align-center',formatter :'testTableDescFormatter'}, {key:"testTableComments",label: "Test Item<br>Results/Comments<br>", sortable:true, resizeable:true, className: 'align-center',formatter :'testTableCommentsFormatter'} ]; var aiDataSource = new tsi.async.XhrJsonDataSource('testTableAction.do?method=getAlltestTables'); aiDataSource.responseSchema = { resultsList: 'data.testTable', fields: ["testTableStatus", "testTableDesc","testTableComments"] }; var testTableDataTable = new YAHOO.widget.DataTable("TestTable", aiColumnDefs, aiDataSource, aiConfig,{caption:"",selectionMode:"single"}); testTableDataTable.subscribe("rowMouseoverEvent", testTableDataTable.onEventHighlightRow); testTableDataTable.subscribe("rowMouseoutEvent", testTableDataTable.onEventUnhighlightRow); testTableDataTable.subscribe("rowClickEvent", testTableDataTable.onEventSelectRow); testTableDataTable.subscribe("cellClickEvent", ontestTableTableCellClick); testTableDataTable.subscribe("renderEvent", function(){ initAIEditableFields(); initialAIPopupCall = false; }); return testTableDataTable; }; Creating instances Code: function renderTestDataTable(dmID) { if(null == testTableTable ){ testTableTable = new TestTableconfig(aiConfig); } else { var oRequest = testTableTable.get("generateRequest")(); testTableTable.getDataSource().sendRequest(oRequest, { success : this.testTableTable.onDataReturnInitializeTable, failure : this.testTableTable.onDataReturnInitializeTable, scope : this.testTableTable, argument: this.testTableTable.getState() }, testTableTable); } }; Kindly help. |
|
I don't see any delete/remove events in this code. Do the highlight and selection work? They should. Is ontestTableTableCellClink the one not working? What does it do?
Your description of the issue is what usually happens when attaching event listeners to DOM elements within the DataTable. Using DataTable's own events to listen to those events as they bubble to the container is the right thing to do as they are preserved even when the contents are changed. |
|
Hi,
Seems the full code did not publish. Misssing part of declaration [code] var testTableDataTable = new YAHOO.widget.DataTable("TestDataTable", aiColumnDefs, aiDataSource, aiConfig,{caption:"",selectionMode:"single"}); testTableDataTable.subscribe("renderEvent", function(){ initEditableFields(); }); testTableDataTable.subscribe("rowMouseoverEvent", actionItemDataTable.onEventHighlightRow); testTableDataTable.subscribe("rowMouseoutEvent", actionItemDataTable.onEventUnhighlightRow); testTableDataTable.subscribe("rowClickEvent", actionItemDataTable.onEventSelectRow); testTableDataTable.subscribe("cellClickEvent", onTestTableCellClick); return actionItemDataTable; } The onTestTableCellClick is the function which deletes the row (Not posting the code ). rowMouseoverEvent, rowMouseoutEvent,rowClickEvent, cellClickEvent all the events fired for 1st time datatable is created . On the second time datatable is called the initEditableFields (method in render) event gets called but no one other events get fired. |
Prasath M
|
How to make selected column blink in yui data table?
How to change default selection color of selected column? |
|
The datable being on a pop-up could be a reason of such behaviour?
|
|
Also sorting on datatable does not work for data refreshed by requerry. For the 1st ime when data table is created the sorting works. I just rearticulate that the data table is on a pop up.
|
|
What you showed is standard DataTable fare and it works so if it doesn't work it is in the part of the code that you are not showing.
|
|
I agree with Neha
|
| Page 1 of 1 | [ 8 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group