cancel
Showing results for 
Search instead for 
Did you mean: 

Underline Grid Column Header Text by Code

Former Member
0 Kudos

Hi,

I am using Grid object.. and i am sorting all column's wise data on click event of all Grid Column headers.but i dont' have any option to show that this column has been sorted. my means that in a SAP b1 Grid there is red color picture come on column header when columns are sorted.so user knows that this column is sorted... i am also using Grid object.. so i want to show that this column is sorted then how it is possible.... i am trying to change header Caption with underline... but i am not able to do this... so please tell me is this possible to change column header text in Underline format by code.... if u have other view to show this column is sorted.

then please tell me.........

Ur efforts are apreciated in advance...

thnx

deepak

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Deepak,

Im using it that in query for sorting Im using * sign and as clause. For example

oForm.DataSources.DataTables.Item(0).ExecuteQuery("select CardCode as 'Card Code*', CardName, DocDate, DocNum, DocTotal, DocStatus from OINV order by cardcode desc")

Maybe when you change the * fro some specific character, for example in unicode 25BC ▼

Former Member
0 Kudos

Thanks for reply,

I am not using ExecuteQuery for Load the data into Grid. I am using my own database not B1. so ExecuteQuery Method is not applicable for me... and i am filling the grid manually with Column and Row Object.... so please tell me how is it possible..... could i change Header of Column on runtime..

thnx

deepak

Former Member
0 Kudos

I think that no, because for grid is only property for .rowheaders as width.

BTW, why you fill it manually and dont use execte query - it works for non sap dbs as well (use only correct prefix before table names).

Nussi
Active Contributor
0 Kudos

Hi Deepak,

maybe you should try to make a ExecuteQuery that gives no result - just to "label" the RowHeaders.

and than fill the grid row by row with your routine/code.

lg David

Former Member
0 Kudos

Thnx for reply,

but How is it possible... will u send me some peice of code... or details... basically i have already tried many ways... but i am also struck... so i am not able to unserstand what i will do....there are many limitations with grid object. Customized controls does not behaviour like SAP b1 Controls...

for Ex; We Can not Bind or Put Data on RowsHeader Column of Grid Object.so we can not give row number in Grid Object...

but now i require to notify user that this column is sorted and Search Row is working on this column.

Nussi
Active Contributor
0 Kudos

ok,

when you run this c# code example:


oForm = globals.SBO_Application.Forms.Item(FormUID);

oForm.DataSources.DataTables.Add("MyDataTable");

((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).DataTable = oForm.DataSources.DataTables.Item("MyDataTable");

oForm.DataSources.DataTables.Item(0).ExecuteQuery("SELECT CardCode as 'CardName u25BC', CardName as 'CardName' FROM OCRD WHERE 1=2");

//((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).CollapseLevel = 2;
((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).AutoResizeColumns();

((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Single;
oForm.Items.Item("grid").AffectsFormMode = false;

you will see you get an empty grid where the CardName has a symbol to show that it is sorted.

now you can fill the grid with your code.

but i think it would be better to try to use only executequery to fill the grid.

if everything fails do something what i did in past:

use a combobox or a label to show

"SORTED BY: CARDCODE"

i hope it anyway helps a bit.

lg David

Former Member
0 Kudos

Thanks,

I have done. basically for that, i have changed text style of Sorted Column... by this ;

_DataGrid.Columns.Item(pVal.ColUID).TextStyle = 1;

here coumn's text is Bold type format.

Text Style | Description

1 | - for Bold

4 | - for Underline