North American Sales: 1-800-231-8588
Global Contacts
My Account
Menu
North American Sales: 1-800-321-8588
My Account
Sign In/Register
Design & Development
Design & Develop
Best Value
Infragistics Ultimate
The complete toolkit for building high performing web, mobile and desktop apps.
Indigo.Design
Use a unified platform for visual design, UX prototyping, code generation and application development.
Web
Ignite UI for Angular
Ignite UI for JavaScript
Ignite UI for React
Ultimate UI for ASP.NET
Indigo.Design
Desktop
Ultimate UI for Windows Forms
Ultimate UI for WPF
Prototyping
Indigo.Design
Mobile
Ultimate UI for Xamarin
Ultimate UI for iOS
Ultimate UI for Android
Automated Testing Tools
Test Automation for Micro Focus UFT: Windows Forms
Test Automation for Micro Focus UFT: WPF
Test Automation for IBM RFT: Windows Forms
UX
Indigo.Design Desktop
Collaborative prototyping and remote usability testing for UX & usability professionals
Indigo.Design
A Unified Platform for Visual Design, UX Prototyping, Code Generation, and App Development
Business Intelligence
Reveal Embedded
Accelerate your time to market with powerful, beautiful dashboards into your apps
Reveal App
Empower everyone in your organization to use data to make smarter business decisions
Team Productivity
Learn & Support
Support
Help & Support Documents
Blogs
Forums
Product Ideas
Reference Applications
Customer Stories
Webinars
eBook & Whitepapers
Events
Free Trials
Pricing
Product Pricing / Buy Online
Renew Existing License
Contact Us
Forums
Ultimate UI for Windows Forms
Your Privacy Matters
: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use.
Cookie Policy
Close
State
Not Answered
Replies
231 replies
Subscribers
6 subscribers
Views
2917321 views
Users
0 members are here
UltraGrid
Share
More
Cancel
3555
Handling Group By Feature when grouping different columns
Patrick
posted
over 17 years ago
I have the group by feature enabled on the wingrid control. However, when I
add a column to the grouping area, the following proedure fails.
My question is, do I have to write different procedures for each grouping
case? What is the most efficient way of handling this?
private void CalculateGridCells()
{
//Get Current Row
int CurrentRow = ultraGrid1.ActiveCell.Row.Index;
int CurrentCol = ultraGrid1.ActiveCell.Column.Index;
//Enable Cells Editing
DeactivateRows(false);
//Disable AfterCellUpdate Event
this.ultraGrid1.EventManager.SetEnabled(GridEventIds.AfterCellUpdate,
false);
try
{
switch (this.ultraGrid1.Rows[CurrentRow].Cells["Epi"].Value.ToString())
{
case "Input Prevalent Population":
ultraGrid1.Rows[CurrentRow + 2].Cells[CurrentCol].Value =
(int)ultraGrid1.Rows[CurrentRow].Cells[CurrentCol].Value *
(int)ultraGrid1.Rows[CurrentRow + 1].Cells[CurrentCol].Value;
ultraGrid1.Rows[CurrentRow + 4].Cells[CurrentCol].Value =
(int)ultraGrid1.Rows[CurrentRow + 2].Cells[CurrentCol].Value *
(int)ultraGrid1.Rows[CurrentRow + 3].Cells[CurrentCol].Value;
break;
case "DR Percentage Diagnosed":
ultraGrid1.Rows[CurrentRow + 1].Cells[CurrentCol].Value =
(int)ultraGrid1.Rows[CurrentRow].Cells[CurrentCol].Value *
(int)ultraGrid1.Rows[CurrentRow - 1].Cells[CurrentCol].Value;
ultraGrid1.Rows[CurrentRow + 3].Cells[CurrentCol].Value =
(int)ultraGrid1.Rows[CurrentRow + 1].Cells[CurrentCol].Value *
(int)ultraGrid1.Rows[CurrentRow + 2].Cells[CurrentCol].Value;
break;
case "DR Percentage Treated":
ultraGrid1.Rows[CurrentRow + 1].Cells[CurrentCol].Value =
(int)ultraGrid1.Rows[CurrentRow].Cells[CurrentCol].Value *
(int)ultraGrid1.Rows[CurrentRow - 1].Cells[CurrentCol].Value;
break;
default:
//dostuff;
break;
}
}
finally
{
this.ultraGrid1.EventManager.SetEnabled(GridEventIds.AfterCellUpdate, true);
DeactivateRows(true); //Lock Rows
}
}
3555
Patrick
posted
over 17 years ago
in reply to
Mike Saltzman
I attached a sample of my data in excel. The epi segment consists of 5
attributes that are related to one another, via formulas.
You are right in that using the row index would fail because when grouped
the order changes.
Is there a way I can read the column values of the other columns in the
active row and use that to update the other cells?
For instance, if I was able to read a given pop, country, epi, date column,
I now know that I have to update the corresponding epi data points of that
given pop, country, date column. If I do this, how would I go about
handling if the users group by epi? BTW, they cannot group by date fields,
I am locking those.
wrote in message news:9997@news.labs.infragistics.com...
> Hi Peryan,
>
> I'm a little unclear on what you want to acheive here. If your rows are
> grouped, then they are no longer in the same order they were originally
> in. Nor are they even in a single collection any more. They display in a
> hierarchy with parent group-by rows and child data rows. So using a
> relative row index is simply not going to work.
>
> It seems to me like your logic relies on the rows being in a single
> collection an in a certain order. So if that's the case, then maybe you
> should not allow grouping?
>
> Since I don't know what your data represents or what the rules are,
> there's no way I can tell you how to get the row you want. You seem to be
> starting from the ActiveRow and going down from there, so you could walk
> the chain in a more efficient way. The row has methods like
> HasNextSibling, GetSibling, and a Parent property that will let you walk
> up and down the chain.
>
Cancel
Reply
Cancel
3555
Patrick
posted
over 17 years ago
in reply to
Mike Saltzman
I attached a sample of my data in excel. The epi segment consists of 5
attributes that are related to one another, via formulas.
You are right in that using the row index would fail because when grouped
the order changes.
Is there a way I can read the column values of the other columns in the
active row and use that to update the other cells?
For instance, if I was able to read a given pop, country, epi, date column,
I now know that I have to update the corresponding epi data points of that
given pop, country, date column. If I do this, how would I go about
handling if the users group by epi? BTW, they cannot group by date fields,
I am locking those.
wrote in message news:9997@news.labs.infragistics.com...
> Hi Peryan,
>
> I'm a little unclear on what you want to acheive here. If your rows are
> grouped, then they are no longer in the same order they were originally
> in. Nor are they even in a single collection any more. They display in a
> hierarchy with parent group-by rows and child data rows. So using a
> relative row index is simply not going to work.
>
> It seems to me like your logic relies on the rows being in a single
> collection an in a certain order. So if that's the case, then maybe you
> should not allow grouping?
>
> Since I don't know what your data represents or what the rules are,
> there's no way I can tell you how to get the row you want. You seem to be
> starting from the ActiveRow and going down from there, so you could walk
> the chain in a more efficient way. The row has methods like
> HasNextSibling, GetSibling, and a Parent property that will let you walk
> up and down the chain.
>
Cancel
Reply
Cancel
3555
Patrick
posted
over 17 years ago
in reply to
Mike Saltzman
I attached a sample of my data in excel. The epi segment consists of 5
attributes that are related to one another, via formulas.
You are right in that using the row index would fail because when grouped
the order changes.
Is there a way I can read the column values of the other columns in the
active row and use that to update the other cells?
For instance, if I was able to read a given pop, country, epi, date column,
I now know that I have to update the corresponding epi data points of that
given pop, country, date column. If I do this, how would I go about
handling if the users group by epi? BTW, they cannot group by date fields,
I am locking those.
wrote in message news:9997@news.labs.infragistics.com...
> Hi Peryan,
>
> I'm a little unclear on what you want to acheive here. If your rows are
> grouped, then they are no longer in the same order they were originally
> in. Nor are they even in a single collection any more. They display in a
> hierarchy with parent group-by rows and child data rows. So using a
> relative row index is simply not going to work.
>
> It seems to me like your logic relies on the rows being in a single
> collection an in a certain order. So if that's the case, then maybe you
> should not allow grouping?
>
> Since I don't know what your data represents or what the rules are,
> there's no way I can tell you how to get the row you want. You seem to be
> starting from the ActiveRow and going down from there, so you could walk
> the chain in a more efficient way. The row has methods like
> HasNextSibling, GetSibling, and a Parent property that will let you walk
> up and down the chain.
>
Cancel
Reply
Cancel
3555
Patrick
posted
over 17 years ago
in reply to
Mike Saltzman
I attached a sample of my data in excel. The epi segment consists of 5
attributes that are related to one another, via formulas.
You are right in that using the row index would fail because when grouped
the order changes.
Is there a way I can read the column values of the other columns in the
active row and use that to update the other cells?
For instance, if I was able to read a given pop, country, epi, date column,
I now know that I have to update the corresponding epi data points of that
given pop, country, date column. If I do this, how would I go about
handling if the users group by epi? BTW, they cannot group by date fields,
I am locking those.
wrote in message news:9997@news.labs.infragistics.com...
> Hi Peryan,
>
> I'm a little unclear on what you want to acheive here. If your rows are
> grouped, then they are no longer in the same order they were originally
> in. Nor are they even in a single collection any more. They display in a
> hierarchy with parent group-by rows and child data rows. So using a
> relative row index is simply not going to work.
>
> It seems to me like your logic relies on the rows being in a single
> collection an in a certain order. So if that's the case, then maybe you
> should not allow grouping?
>
> Since I don't know what your data represents or what the rules are,
> there's no way I can tell you how to get the row you want. You seem to be
> starting from the ActiveRow and going down from there, so you could walk
> the chain in a more efficient way. The row has methods like
> HasNextSibling, GetSibling, and a Parent property that will let you walk
> up and down the chain.
>
Cancel
Reply
Cancel
3555
Patrick
posted
over 17 years ago
in reply to
Mike Saltzman
I attached a sample of my data in excel. The epi segment consists of 5
attributes that are related to one another, via formulas.
You are right in that using the row index would fail because when grouped
the order changes.
Is there a way I can read the column values of the other columns in the
active row and use that to update the other cells?
For instance, if I was able to read a given pop, country, epi, date column,
I now know that I have to update the corresponding epi data points of that
given pop, country, date column. If I do this, how would I go about
handling if the users group by epi? BTW, they cannot group by date fields,
I am locking those.
wrote in message news:9997@news.labs.infragistics.com...
> Hi Peryan,
>
> I'm a little unclear on what you want to acheive here. If your rows are
> grouped, then they are no longer in the same order they were originally
> in. Nor are they even in a single collection any more. They display in a
> hierarchy with parent group-by rows and child data rows. So using a
> relative row index is simply not going to work.
>
> It seems to me like your logic relies on the rows being in a single
> collection an in a certain order. So if that's the case, then maybe you
> should not allow grouping?
>
> Since I don't know what your data represents or what the rules are,
> there's no way I can tell you how to get the row you want. You seem to be
> starting from the ActiveRow and going down from there, so you could walk
> the chain in a more efficient way. The row has methods like
> HasNextSibling, GetSibling, and a Parent property that will let you walk
> up and down the chain.
>
Cancel
Reply
Cancel
>