3 Replies Latest reply on Jun 5, 2017 9:52 AM by polinao RSS
    fgrondin Explorer

    List select everything by default

    Hey guys,

    How can I select all item in the list by default? Now this is what I have so far, but as you see, the selected rows in the list doesn't show anything. But then, if I change the selection, the grid is populated with the new selected item. So basically, I can select every rows by default, but the it appears like the selected rows is null. And I would need the selected rows to be All instead at default.

      • Re: List select everything by default
        polinao Collaborator

        Let me run this on my instance, and I will get back to you soon.

          • Re: List select everything by default
            fgrondin Explorer

            Just for more information about this,

            I've tried adding a property like the autoselectfirstrow.

             

            I've got this part of code which doesn't work.

             

            //else if ( this.getProperty( 'SelectAllDefault' ) === true )
                                //{
                                //    TW.log.error( "1b" );
                                //    // do this with delay ... if you have a lot of grids accessing the same data, they may not have populated and we're already telling them the row to select 
                                //    setTimeout( function ()
                                //    {
                                //        // make sure we haven't been destroyed
                                //        if ( mygrid !== null )
                                //        {
                                //            TW.log.error( "2b" );
                                //            // select the first row
                                //            var numRows = mygrid.getRowsNum();
                                //            TW.log.error( numRows );
                                //            var selected = [];
                                //            for ( var i = 0; i < numRows; i++ )
                                //            {
                                //                selected.push( i );
                                //                TW.log.error( "numb : "  +numRows );
                                //            }
                                //            thisWidget.ignoreSelectionChanges = true;
                                //            for ( var i = 0; i < selected.length; i++ )
                                //            {                                 
                                //                mygrid.selectRow( selected[i], false, false, true );
                                //                TW.log.error( "selected : " + selected[i] );
                                //            }
            
            
                                //            thisWidget.ignoreSelectionChanges = false;
            
            
                                //            thisWidget.updateSelection( 'Data', selected );
            
            
                                //        }
                                //    }, 100 );
                                //}