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 » Move row in a grid Collapse All
Subject Author Date
Offer Har Apr 17, 2007 - 1:45 PM

Dear Support,

I need to move a row in a grid up or down when a user clicks on a button.
How can this be done?

Thanks,
Ron.

Technical Support Apr 18, 2007 - 11:44 AM

There is a SwapDroppedSeries method in the CExtGridDataProvider class which moves the column or row to a new position and returns true if succeeded.

CExtGridDataProvider & _DataProvider = m_wndGrid.OnGridQueryDataProvider();
VERIFY(
	_DataProvider.SwapDroppedSeries(
		false,
		nRowColNoSrc,
		nRowColNoDropBefore,
		&m_wndGrid
		)
	);


Offer Har Apr 18, 2007 - 12:18 PM

Dear Support,

I am trying to move the selected row down, this is what I wrote:

CPoint pt = FocusGet();
CExtGridDataProvider& dataProvider = OnGridQueryDataProvider();
dataProvider.SwapDroppedSeries(false, pt.y, pt.y+1, this);
OnSwDoRedraw();

And nothing happened. What am I don’t wrong? What are the value I need to pass at the nRowColNoSrc and nRowColNoDropBefore?

Thanks,
Ron.

Technical Support Apr 19, 2007 - 2:22 AM

Let’s assume Yg is a zero-based row number in the grid control which has Yt header rows at the top and Yb header rows at the bottom. Then the data provider index should be as follows:

Ydp = Yt + Yb + Yg