on 09-18-2017 9:08 AM
I have problem with collapse and expand functionality. I've added some rows and set on grid collapseLevel = 1.
Everything is displayed correctly and grouped as I expected but when i want to catch a row data I get data wich is incorrect. The problem is that when the data is grouped is ordered with a groups and clicking any row gives me other rows data.
For example when I click row 3 I get the data from row 2.
Grid EqElemGrd = form.Items.Item(PhysicalPropertyFormulaForm.Controls.EquationElements.Grid).Specific;
DataTable EqElemData = form.DataSources.DataTables.Item(PhysicalPropertyFormulaForm.DataSources.EquationElements.DataTable);
EqElemData.Rows.Clear();
Dictionary<string, string> functions = new Dictionary<string, string>();
functions.Add("ABS(x)", "Returns the absolute value of x.");
functions.Add("ACOS(x)", "Returns the arc cosine of x, in radians.");
functions.Add("ASIN(x)", "Returns the arc sine ofx, in radians.");
functions.Add("ATAN2(x; y)", "Returns ATAN(y/x) taking signs of x and y into account.");
functions.Add("ATAN(x)", "Returns the arc tangent of x, in radians.");
functions.Add("CEILING(x; signif)", "Returns the nearest multiple of signif");
int i = 0;
foreach (var func in functions)
{
EqElemData.Rows.Add();
EqElemData.SetValue(PhysicalPropertyFormulaForm.DataSources.EquationElements.Columns.Type, i, "Function");
EqElemData.SetValue(PhysicalPropertyFormulaForm.DataSources.EquationElements.Columns.Code, i, func.Key);
EqElemData.SetValue(PhysicalPropertyFormulaForm.DataSources.EquationElements.Columns.Description, i, func.Value);
i++;
}
EqElemData.Rows.Add();
EqElemData.SetValue(PhysicalPropertyFormulaForm.DataSources.EquationElements.Columns.Type, i, "Global");
EqElemData.SetValue(PhysicalPropertyFormulaForm.DataSources.EquationElements.Columns.Code, i, "TW");
EqElemData.SetValue(PhysicalPropertyFormulaForm.DataSources.EquationElements.Columns.Description, i, "Total Formula Weight");
i++;
EqElemData.Rows.Add();
EqElemData.SetValue(PhysicalPropertyFormulaForm.DataSources.EquationElements.Columns.Type, i, "Global");
EqElemData.SetValue(PhysicalPropertyFormulaForm.DataSources.EquationElements.Columns.Code, i, "TV");
EqElemData.SetValue(PhysicalPropertyFormulaForm.DataSources.EquationElements.Columns.Description, i, "Total Formula Volume");
i++;
QueryManager qm = new QueryManager();
qm.SimpleTableName = "@CT_PF_OIPR";
qm.SetSimpleWhereFields("U_FrlaPrp");
qm.SetSimpleResultFields("U_FrlaType", "U_PrpCode", "U_PrpName");
using (var result = qm.ExecuteSimpleParameters("", "Y"))
{
for (int k = 0; k < result.RecordCount; k++)
{
EqElemData.Rows.Add();
string U_PrpCode = result.Fields.Item("U_PrpCode").Value;
string U_PrpName = result.Fields.Item("U_PrpName").Value;
string U_FrlaType = result.Fields.Item("U_FrlaType").Value;
EqElemData.SetValue(PhysicalPropertyFormulaForm.DataSources.EquationElements.Columns.Type, k + i, U_FrlaType);
EqElemData.SetValue(PhysicalPropertyFormulaForm.DataSources.EquationElements.Columns.Code, k + i, U_PrpCode);
EqElemData.SetValue(PhysicalPropertyFormulaForm.DataSources.EquationElements.Columns.Description, k + i, U_PrpName);
result.MoveNext();
}
}
EqElemGrd.CollapseLevel = 1;
EqElemGrd.Rows.CollapseAll();
Hi,
The problem happened because when you collapse the grid, the rows are not the same as the datatable it is linked to, so you can use GetDataTableRowIndex to get the right row
EqBody.Value += ElementsBodyGrd.DataTable.GetValue(PhysicalPropertyFormulaForm.Controls.EquationElements.Columns.Code, ElementsBodyGrd.GetDataTableRowIndex(itemEvent.Row));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your help. I have additional problem. When I update on the form collapsed and expand functionality is missing. Everything is viewed as there is no collapselevel = 1. Have you got any idea how to improve it. I want to have grouped view after update. I've checked and initialize events like updateafter, onformstatuschanged, onformloadafter.
This describes and resolves my issue:
https://archive.sap.com/discussions/thread/1692725#
Thanks once more for your effort.
Have a good day 🙂
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.