Objective Grid: Enabling row dragging

Article ID: 567
Last updated: 11 Apr, 2018
Article ID: 567
Last updated: 11 Apr, 2018
Revision: 3
Views: 1524
Posted: 10 Jan, 2001
by Meltreger B.
Updated: 11 Apr, 2018
by Meltreger B.

Problem


How can I enable dragging rows? I want the user to be able to move columns to a new position just the same way as is possible with columns.


Cause



Action


In your OnInitialUpdate() routine, you should turn on the EnableMoveRows() attribute. You should call EnableMoveRows() after calling the base class OnInitialUpdate() routine.

Example:

void CDaoqueryView::OnInitialUpdate()
{
...

// Attach the recordset object
SetRecordset(&pDoc->m_dynamicSet);

// Standard initialization, will create other objects
// such as column names, widths, base styles, ...
CMyDaoRecordView::OnInitialUpdate();

GetParam()->EnableMoveRows(TRUE);

}

If you want to serialize reordered rows, you have to add code which serialize the row indexes in your documents Serialize() method.

Example:

void CDaoqueryDoc::Serialize(CArchive& ar)
{
...

if (ar.IsStoring())
{

// column settings, base styles
ar << m_pParam;

...

}
else
{
// column settings, base styles
ar >> m_pParam;

// Open recordset, ...

}

m_pParam->m_awRowIndex.Serialize(ar);

}

This article was:   Helpful | Not helpful
Report an issue
Article ID: 567
Last updated: 11 Apr, 2018
Revision: 3
Views: 1524
Posted: 10 Jan, 2001 by Meltreger B.
Updated: 11 Apr, 2018 by Meltreger B.

Others in this category