andyhill Posted April 10, 2020 Posted April 10, 2020 IDE Desktop Grid Assigned Editors at runtime fail to re assign - please advise. //////////////////////////////////////////////////////////////////////////// cbGender.BeginUpdate; cbGender.Items.Clear; cbGender.Items.Add(''); cbGender.Items.Add('Male'); cbGender.Items.Add('Female'); cbGender.EndUpdate; //////////////////////////////////////////////////////////////////////////// TAccessGrid(dbGridFriends).Columns.BeginUpdate; TAccessGrid(dbGridFriends).Columns.Clear; ... // Gender TAccessGrid(dbGridFriends).Columns.Add; TAccessGrid(dbGridFriends).Columns.Items.FieldName:= 'Gender'; TAccessGrid(dbGridFriends).Columns.Items.Visible:= True; TAccessGrid(dbGridFriends).Columns.Items.Title.Alignment:= taLeftJustify; TAccessGrid(dbGridFriends).Columns.Items.Title.Caption:= 'Gender'; TAccessGrid(dbGridFriends).Columns.Items.Width:= 65; TAccessGrid(dbGridFriends).Columns.Items.Editor:= cbGender; // FAILS TO ASSIGN AT RUNTIME (cbGender is on a Hidden Panel) ??? TAccessGrid(dbGridFriends).Columns.Items.Font.Color:= clBlack; TAccessGrid(dbGridFriends).Columns.Items.ShowSummary:= False; Quote
Sherzod Posted April 10, 2020 Posted April 10, 2020 4 hours ago, andyhill said: IDE Desktop Grid Assigned Editors at runtime fail to re assign - please advise. Hello, For example, you can try this: procedure TMainForm.UniButton1Click(Sender: TObject); begin with UniDBGrid1 do JSInterface.JSCall('setEditor', [UniComboBox1.JSControl], ColumnByName('city').JSColumn); with UniComboBox1 do JSInterface.JSAssign('valueField', ['val']); end; Quote
Masteritec Posted March 1, 2021 Posted March 1, 2021 On 4/10/2020 at 1:30 PM, Sherzod said: Hello, For example, you can try this: procedure TMainForm.UniButton1Click(Sender: TObject); begin with UniDBGrid1 do JSInterface.JSCall('setEditor', [UniComboBox1.JSControl], ColumnByName('city').JSColumn); with UniComboBox1 do JSInterface.JSAssign('valueField', ['val']); end; Prompt Error : setEditor is not a function Quote
Sherzod Posted March 1, 2021 Posted March 1, 2021 57 minutes ago, Masteritec said: Prompt Error : setEditor is not a function Can you make a simple testcase for this? Quote
Masteritec Posted March 1, 2021 Posted March 1, 2021 2 minutes ago, Sherzod said: Can you make a simple testcase for this? Refer this GridEditors2.7z Quote
Sherzod Posted March 1, 2021 Posted March 1, 2021 4 hours ago, Masteritec said: Refer this GridEditors2.7z 1.7 MB · 2 downloads One possible solution for your case: procedure TMainForm.UniButton1Click(Sender: TObject); Var LubdbgCol: TUniBaseDBGridColumn; begin UniDBGrid1.Columns.Clear(); LubdbgCol:= UniDBGrid1.Columns.Add; LubdbgCol.FieldName:= 'City'; //LubdbgCol.Editor:= UniComboBox1; with UniDBGrid1 do //JSInterface.JSCall('setEditor', [UniComboBox1.JSControl], ColumnByName('city').JSColumn); JSInterface.JSCode('Ext.defer(function(){'#1'.getColumnManager().getColumns().slice(-1)[0].setEditor('+ UniComboBox1.JSName +')}, 1000);'); with UniComboBox1 do JSInterface.JSAssign('valueField', ['val']); end; Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.