Showing posts with label DevExpress. Show all posts
Showing posts with label DevExpress. Show all posts

Friday, 11 June 2021

DevExpress TcxGrid Properties Setting

 TcxGrid dalam komponen DevExpress  adalah komponen grid yang aku suka gunakan dari segi sorting data atau filter data.  Dengan hanya klik header column, data jadi auto sort ascending descending. 

Untuk filter juga mudah. Drag sahaja header mana-mana column grid ke atas header. 

Namun begitu banyak setting yang perlu dilakukan untuk dapatkan fungsi-fungsi yang menarik. 

Gambar 1 : TcxGrid


 Ini antara asas setting properties yang mana perlu klik butang cxGrid1DBTableView1 seperti di bawah: 

Gambar 2: customize tcxgrid


1. Setkan Datasource perlu klik DataController. 

2. Filter Row,  pilih Visible = True

3. Navigator,  pilih Visible = True

   



4. Footer,  pilih Visible = True. 

Footer ini perlu set TRUE sekiranya kita nak buat summary  jumlah  di bahagian bawah grid. Pastikan grid dimasukkan datasource dahulu. Kalau tak masukkan, tak boleh nak pilih field.

  • Double klik gambar 2 di atas. Keluarlah gambar di bawah ni. 
  • Klik tab summary.
  • Klik button Add untuk dapatkan item. Nak banyak item, tekan sahaja butang Add beberapa kali
  • Nak setting item tersebut, pilih item dan isi maklumat di dalam properties

       

Di dalam Kind ada bermacam pilihan: skSum, skAverange, skMax, skMin, skNone. Kerap digunakan adalah skSum untuk mudah tengok jumlah data. 



5. GroupByBox,  pilih Visible = True

6. Indicatorr,  pilih Visible = True











DevExpress TcxGrid Color Cell

Contoh coding warnakan cell row untuk grid DevExpress. 


procedure TfrmMain.GridMainDBTableView1CustomDrawCell(

  Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;

  AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);

begin

  if AViewInfo.GridRecord.Selected then

  begin

    ACanvas.Brush.Color:= clScrollBar;

    ACanvas.Font.Color:= clBlack;

  end;



    if (AViewInfo.GridRecord.Values[GridMainDBTableView1ES_AMT.Index] <= 0) then

        ACanvas.Font.Color:= clBlue;


    if (AViewInfo.GridRecord.Values[GridMainDBTableView1ES_AMT_LIMIT.Index] <

         AViewInfo.GridRecord.Values[GridMainDBTableView1ES_AMT_DISC.Index]) then

       ACanvas.Font.Color:= clRed;

  end;


 end;


Friday, 25 May 2018

cxDBLookupComboBox Setting Properties



Setting Properties
DropDownAutoSize = True
DropDownSizeable = True
KeyFieldNames = J_KEY
ListFieldNames = J_KEY;J_BANK;J_CUSTOMER;J_TERMINAL;J_LOCATION
ListSource = datasource


OnCloseUp
procedure Tform1.cxDBLookupComboBox1PropertiesCloseUp(Sender: TObject);
begin
  with TcxDBLookupComboBox(Sender).Properties.Grid.DataController do
  begin

    if not VarIsNull(GetValue(FocusedRecordIndex, 0))then
       qryMainPCM_JOBKEY.AsString:= Values[FocusedRecordIndex, 0];

    if not VarIsNull(GetValue(FocusedRecordIndex, 1))then
       qryMainPCM_BANK.AsString:= GetValue(FocusedRecordIndex, 1);
   
    if not VarIsNull(GetValue(FocusedRecordIndex, 3))then
      qryMainPCM_TERMINAL.AsString := GetValue(FocusedRecordIndex, 3);       //Values[FocusedRecordIndex, 3]; 


    if not VarIsNull(GetValue(FocusedRecordIndex, 4))then
      qryMainPCM_LOCATION.AsString:= Values[FocusedRecordIndex, 4];   
   
  end;

end;

Monday, 23 March 2015

Setting TcxGrid DevExpress in Delphi

Before setting

A. NAVIGATOR
Show Navigator
Step:
1. Click cxGrid1DBTableView
2. In Properties -->select Navigator --> select Visible =True

Show InfoPanel
1. Click cxGrid1DBTableView
2. In Properties --> select Navigator -->select InfoPanel--> select Visible =True

B. INDICATOR
Step:
1. Click cxGrid1DBTableView
2. In Properties -->select Option View -->  select Indicator =True

After Setting



REMOVE GROUP BY BOX

Step:
1. Click cxGrid1DBTableView
2. In Properties -->select Option View -->  select GroupByBox = False
Before Remove Group By Box
 
After Remove Group By Box