[ 8 posts ]

Neha

  • Username: Nehavans
  • Joined: Mon May 07, 2012 3:10 am
  • Posts: 4
  • GitHub: Nehavans
  • Gists: Nehavans
  • IRC: Nehavans
  • Offline
  • Profile

Issues in event handilng of datable having requery

Post Posted: Mon May 07, 2012 3:37 am
+0-
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.

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: Issues in event handilng of datable having requery

Post Posted: Mon May 07, 2012 7:06 am
+0-
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.

Neha

  • Username: Nehavans
  • Joined: Mon May 07, 2012 3:10 am
  • Posts: 4
  • GitHub: Nehavans
  • Gists: Nehavans
  • IRC: Nehavans
  • Offline
  • Profile
Tags:

Re: Issues in event handilng of datable having requery

Post Posted: Mon May 07, 2012 8:06 am
+1-
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

  • Username: prasathm
  • Joined: Thu Apr 19, 2012 1:20 am
  • Posts: 22
  • Twitter: prasath116
  • IRC: Prasath M
  • Offline
  • Profile

Re: Issues in event handilng of datable having requery

Post Posted: Mon May 07, 2012 8:03 pm
+0-
How to make selected column blink in yui data table?
How to change default selection color of selected column?

Neha

  • Username: Nehavans
  • Joined: Mon May 07, 2012 3:10 am
  • Posts: 4
  • GitHub: Nehavans
  • Gists: Nehavans
  • IRC: Nehavans
  • Offline
  • Profile

Re: Issues in event handilng of datable having requery

Post Posted: Mon May 07, 2012 9:50 pm
+1-
The datable being on a pop-up could be a reason of such behaviour?

Neha

  • Username: Nehavans
  • Joined: Mon May 07, 2012 3:10 am
  • Posts: 4
  • GitHub: Nehavans
  • Gists: Nehavans
  • IRC: Nehavans
  • Offline
  • Profile

Re: Issues in event handilng of datable having requery

Post Posted: Tue May 08, 2012 1:15 am
+1-
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.

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: Issues in event handilng of datable having requery

Post Posted: Tue May 08, 2012 10:36 pm
+0-
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.

Bylusa

  • Username: bylusa4
  • Joined: Thu Mar 22, 2012 7:33 am
  • Posts: 2
  • Location: Berlin
  • Offline
  • Profile

Re: Issues in event handilng of datable having requery

Post Posted: Wed May 09, 2012 12:07 am
+0-
I agree with Neha
  [ 8 posts ]
Display posts from previous:  Sort by  
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