[Delphi 7] Impossible de modifier une donnée d'un cxGrid
Bonjour,
Je veux créer une saisie toute simple avec un CxGrid avec son datasource associé. L'utilisateur pourra modifier les données directement dans ce cxGrid --> Propriété OptionsData.Editing à True avec aucune colonne en ReadOnly.
Ensuite j'alimente le datasource de mon cxGrid :
Code:
dsrcPIP.DataSet := maFonction(id_produit, id_test);
J'ai donc des données présentes dans mon cxGrid, cependant impossible de les modifier car mon DataSource.State = dsInactive. Je ne comprend pas d'où ça peut venir...Sachant que toutes mes propriétés sont "ouvertes" (pas de ReadOnly, pas d'inactive, etc...).
Ci-dessous le code de ma form :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
| object frmUpdatePIP: TfrmUpdatePIP
Left = 369
Top = 258
Width = 600
Height = 425
AutoSize = True
Caption = 'Mise à jour impact PIP'
Color = clBtnFace
Constraints.MaxWidth = 600
Constraints.MinHeight = 425
Constraints.MinWidth = 600
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Comic Sans MS'
Font.Style = []
FormStyle = fsMDIChild
OldCreateOrder = False
Position = poMainFormCenter
PrintScale = poNone
Visible = True
PixelsPerInch = 96
TextHeight = 15
object grpheader: TcxGroupBox
Left = 0
Top = 0
Align = alTop
Style.BorderStyle = ebsNone
TabOrder = 0
DesignSize = (
584
49)
Height = 49
Width = 584
object l_b_rechercher: TcxButton
Left = 468
Top = 14
Width = 101
Height = 21
Hint = 'Cliquez pour valider la saisie'
Anchors = [akTop, akRight]
Caption = '&Rechercher'
ParentShowHint = False
ShowHint = True
TabOrder = 0
end
object edtADHE_NO_ADHES: TcxButtonEdit
Left = 62
Top = 14
Properties.Alignment.Horz = taRightJustify
Properties.Buttons = <
item
Default = True
Kind = bkEllipsis
end>
Properties.MaskKind = emkRegExprEx
Properties.EditMask = '[0-9]{0,10}'
Properties.MaxLength = 0
TabOrder = 1
Text = '0'
Width = 121
end
object lbl1: TcxLabel
Left = 8
Top = 16
Caption = 'Contrat n°'
end
end
object grpFooter: TcxGroupBox
Left = 0
Top = 357
Align = alBottom
Style.BorderStyle = ebsNone
TabOrder = 1
DesignSize = (
584
30)
Height = 30
Width = 584
object l_b_valider: TcxButton
Left = 376
Top = 4
Width = 102
Height = 21
Hint = 'Cliquez pour enregistrer les modifications'
Anchors = [akTop, akRight]
Caption = '&Enregistrer'
Enabled = False
ParentShowHint = False
ShowHint = True
TabOrder = 0
end
object btnFermer: TcxButton
Left = 490
Top = 4
Width = 90
Height = 21
Hint = 'Cliquer pour fermer la fenêtre'
Anchors = [akTop, akRight]
Caption = '&Fermer'
ParentShowHint = False
ShowHint = False
TabOrder = 1
end
end
object cxgrdPIP: TcxGrid
Left = 0
Top = 49
Width = 584
Height = 308
Align = alClient
TabOrder = 2
object grdGrid1DBTableViewPIP: TcxGridDBTableView
NavigatorButtons.ConfirmDelete = False
DataController.DataSource = dsrcPIP
DataController.Summary.DefaultGroupSummaryItems = <>
DataController.Summary.FooterSummaryItems = <>
DataController.Summary.SummaryGroups = <>
OptionsData.Appending = True
OptionsView.NoDataToDisplayInfoText = 'Aucun contrat de renseigner'
OptionsView.ShowEditButtons = gsebAlways
OptionsView.GroupByBox = False
object grdVieContratDBTableView1NumEvent: TcxGridDBColumn
Caption = 'N° évènement'
DataBinding.FieldName = 'EVEN_NO_EVT'
PropertiesClassName = 'TcxTextEditProperties'
Properties.Alignment.Horz = taLeftJustify
Width = 110
end
object grdVieContratDBTableView1MntBrut: TcxGridDBColumn
Caption = 'Montant brut'
DataBinding.FieldName = 'EVEN_MNT_BRUT'
PropertiesClassName = 'TcxCurrencyEditProperties'
Width = 91
end
object grdVieContratDBTableView1DateEffet: TcxGridDBColumn
Caption = 'Date effet'
DataBinding.FieldName = 'EVEN_DAT_EFF'
Width = 91
end
object grdVieContratDBTableView1PIP: TcxGridDBColumn
Caption = 'Impact PIP'
DataBinding.FieldName = 'EVEN_N_FLG_MAJ_PIP'
PropertiesClassName = 'TcxLookupComboBoxProperties'
Properties.KeyFieldNames = 'CODE'
Properties.ListColumns = <
item
FieldName = 'CODE'
end
item
FieldName = 'LIBELLE'
end>
Properties.ListOptions.ShowHeader = False
Properties.ListSource = dsRefPIP
Width = 289
end
end
object cxgrdGrid1Level1PIP: TcxGridLevel
GridView = grdGrid1DBTableViewPIP
end
end
object dsrcPIP: TDataSource
Left = 432
Top = 40
end
object dsRefPIP: TDataSource
Left = 488
Top = 40
end
end |