Loading ...
Sorry, an error occurred while loading the content.
 

How to unselect a row in a DataTable

Expand Messages
  • Daniel Nunes
    Hello all, I m having trouble to unselect a row that was previously selected. Does anyone have a code snippet that I could take a peek? Thanks. I m doing the
    Message 1 of 3 , Jun 2, 2007
      Hello all, I'm having trouble to unselect a row that was previously
      selected. Does anyone have a code snippet that I could take a peek?

      Thanks.

      I'm doing the following:

      var deSelectRow = function(e){
      var row = minhaTabelaDeDados.getSelectedRows()[0];
      if(row){
      minhaTabelaDeDados.unselectRow(row);
      }

      }
      minhaTabelaDeDados.subscribe('cellClickEvent',deSelectRow);
      minhaTabelaDeDados.subscribe('cellClickEvent',minhaTabelaDeDados.onEventSelectRow);

      But this way it will always be selected =\
    • Daniel Nunes
      Well, I don t know if anyone had to do this before, but I managed to make it work like this: var selectDeSelectRow = function(args){ var row =
      Message 2 of 3 , Jun 2, 2007
        Well, I don't know if anyone had to do this before, but I managed to
        make it work like this:

        var selectDeSelectRow = function(args){
        var row = minhaTabelaDeDados.getSelectedRows()[0];
        if(row){
        minhaTabelaDeDados.unselectRow(row);
        }else{
        minhaTabelaDeDados.selectRow(args.target.parentNode);
        }
        }
        minhaTabelaDeDados.subscribe('cellClickEvent',selectDeSelectRow);
        --- In ydn-javascript@yahoogroups.com, "Daniel Nunes"
        <jaywalker1983@...> wrote:
        >
        > Hello all, I'm having trouble to unselect a row that was previously
        > selected. Does anyone have a code snippet that I could take a peek?
        >
        > Thanks.
        >
        > I'm doing the following:
        >
        > var deSelectRow = function(e){
        > var row = minhaTabelaDeDados.getSelectedRows()[0];
        > if(row){
        > minhaTabelaDeDados.unselectRow(row);
        > }
        >
        > }
        > minhaTabelaDeDados.subscribe('cellClickEvent',deSelectRow);
        >
        minhaTabelaDeDados.subscribe('cellClickEvent',minhaTabelaDeDados.onEventSelectRow);
        >
        > But this way it will always be selected =\
        >
      • Daniel Nunes
        This is better:(For single select Table) var selectDeSelectRow = function(args){ var row = minhaTabelaDeDados.getSelectedRows()[0];
        Message 3 of 3 , Jun 2, 2007
          This is better:(For single select Table)
          var selectDeSelectRow = function(args){
          var row = minhaTabelaDeDados.getSelectedRows()[0];
          minhaTabelaDeDados.selectRow(args.target.parentNode);
          if(row && minhaTabelaDeDados.isSelected(args.target.parentNode)){
          minhaTabelaDeDados.unselectRow(row);
          }
          }
          minhaTabelaDeDados.subscribe('cellClickEvent',selectDeSelectRow);
        Your message has been successfully submitted and would be delivered to recipients shortly.