Jump to content

Desktop, Runtime, Grid, ClearColumns: UnAble to assign Editors


Recommended Posts

Posted

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;

 

Posted
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;

 

  • 10 months later...
Posted
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

Error.png

Posted
4 hours ago, Masteritec said:

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;

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...