Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Sorting in CExtTreeGridWnd Collapse All
Subject Author Date
Offer Har Feb 29, 2008 - 4:55 AM

Dear Support,

I created a tree which should support sorting, but when the header is clicked I get into this assert:

bool CExtTreeGridDataProvider::SortOrderGet(
	CExtGridDataSortOrder & _gdso,
	bool bColumns // true = sort order for columns, false - for rows
	) const
{
	ASSERT_VALID( this );
	_gdso;
	bColumns;
	// this method must never be invoked
	ASSERT( FALSE );
	return true;
}

Obviously something is missing, but what?

Thanks,
Ron.

Technical Support Mar 28, 2008 - 9:19 AM

Thank you for reporting the tree item hiding problem. It was not difficult to fix but was quite hard to find it. Please update the source code for the following method:

void CExtTreeGridCellNode::TreeNodeHiddenSet(
      CExtTreeGridDataProvider & _DP,
      bool bHide
      )
{
      ASSERT_VALID( this );
      ASSERT_VALID( (&_DP) );
      ASSERT_KINDOF( CExtTreeGridDataProvider, (&_DP) );
bool bHidden = TreeNodeHiddenGet();
      if( ( bHidden && bHide ) || ( (!bHidden) && (!bHide) ) )
            return;
      if( bHide )
      {
            if( TreeNodeIsDisplayed() )
            {
                  ULONG nOffset = TreeNodeCalcOffset( true, false );
                  if( nOffset != ULONG(-1L) )
                  {
                        ASSERT( _DP.m_arrGridVis[ nOffset ] == this );
                        INT nCountToRemove = _ContentWeight_Get( true );
                        _DP.m_arrGridVis.RemoveAt( nOffset, nCountToRemove + 1 );
                        CExtTreeGridCellNode * pNodeParent = TreeNodeGetParent();
                        if( pNodeParent != NULL )
                        {
                              ASSERT_VALID( pNodeParent );
                              pNodeParent->_ContentWeight_Decrement( nCountToRemove + 1, true );
                        }
                  }
            }
            ModifyStyleEx( __EGCS_EX_HIDDEN_TREE_NODE, 0 );
      } // if( bHide )
      else
      {
            ModifyStyleEx( 0, __EGCS_EX_HIDDEN_TREE_NODE );
            if( TreeNodeIsDisplayed() )
            {
                  ULONG nOffset = TreeNodeCalcOffset( true, false );
                  if( nOffset != ULONG(-1L) )
                  {
                        INT nCountToInsert = _ContentWeight_Get( true );
                        _DP.m_arrGridVis.InsertAt( nOffset, NULL, nCountToInsert + 1 );
                        _DP.m_arrGridVis.SetAt( nOffset, this );
                        nOffset ++;
                        _Content_FillVisibleArray( _DP.m_arrGridVis, nOffset );
                        CExtTreeGridCellNode * pNodeParent = TreeNodeGetParent();
                        if( pNodeParent != NULL )
                        {
                              ASSERT_VALID( pNodeParent );
                              pNodeParent->_ContentWeight_Increment( nCountToInsert + 1, true );
                        }
                  }
            }
      } // else from if( bHide )
}

Offer Har Mar 28, 2008 - 3:21 PM

Thanks - problem solved


Now, what about the original question of this thread?...

Technical Support Mar 31, 2008 - 11:58 AM

It would be easier for us to regard the root question in this thread as a feature request and implement tree sorting on a column header click as built-in behavior of the CExtTreeGridWnd class.

Offer Har Mar 1, 2008 - 8:41 AM

Can you please explain what I should do so that the clicking of the column header will call the ItemSortChildren function?
As I explained it crashes now, and you say there is a ItemSortChildren function, but it is not utilized when the header is clicked.

Technical Support Mar 1, 2008 - 8:33 AM

The CExtTreeGridWnd::ItemSortChildren() method sorts child items of the specified tree item (root or any other). This method sorts only the children of one level and does not affect deeper level items. It’s possible to code some recursive method based on CExtTreeGridWnd::ItemSortChildren() method for any custom sorting of all the tree grid or its particular branches. But the CExtTreeGridWnd class does not support any kind of automatic sorting action as a reaction to the mouse click on some header cell at top/bottom because we have no idea which rows to sort or not in according to particular customer needs.


Offer Har Mar 24, 2008 - 5:13 AM

Dear Support,


How do I attach this to the existing columns header sorting mechanism? This is a tree grid hybrid, so when the user presses the columns header I need to sort according to the column the user pressed. This is when I get the assert.


Regards,


Ron,