rhennink Posted October 10, 2017 Share Posted October 10, 2017 Hi, I have something weird ;-) When I do the init of a TUnistringGrid en add some column in the grid. At this moment I fill the values of the columns with the start-values via grdData.Columns[iCol].Title.Caption := 'startvalue xxxxx' But when I put a button on the form, and try to update this column (again via grdData.Columns[iCol].Title.Caption := 'bbbbb';) the header is not updated. when I debug i can see that the value is set correctly, but it is not visible on the screen. Can i refresh this column (header) so the value is visible?? Richard Link to comment Share on other sites More sharing options...
Sherzod Posted October 11, 2017 Share Posted October 11, 2017 Hi, Can you try this approach for now ?!: For example for the second column: procedure TMainForm.UniButton1Click(Sender: TObject); begin UniStringGrid1.JSInterface.JSCall('columnManager.getColumns()[1].setText', ['New title']); end; Best regards, 1 Link to comment Share on other sites More sharing options...
mos Posted November 24, 2017 Share Posted November 24, 2017 Hi Delphi Developer, I am trying to setup some columns in a stringgrid dynamically. The ColCount value I had setup at design time was 5. I tried to change the ColCount to 20 in code and then set the captions but get an Ajax Error: O13.columnManager.getColumns(...)[5] is undefined What I do notice when this error is display is that the grid only shows the 5 columns and not the 20. Here is some sample code that I have been testing with. procedure TMainForm.UniButton2Click(Sender: TObject); const TitleJS = 'columnManager.getColumns()[%d].setText'; TitleJS2 = '''' + '%s' + ''''; var liX: Integer; begin UniStringGrid1.ColCount := 20; for liX := 0 to 10 do begin UniStringGrid1.Columns.Add; UniStringGrid1.Columns[liX].Width := 60; UniStringGrid1.JSInterface.JSCall(format(TitleJS,[liX, TitleJS]), format(TitleJS2,['Hello There'])); end; end; Link to comment Share on other sites More sharing options...
Sherzod Posted November 24, 2017 Share Posted November 24, 2017 Hi, Please make a testcase Link to comment Share on other sites More sharing options...
mos Posted November 24, 2017 Share Posted November 24, 2017 Hi Delphi Developer, Attached is a test case. Project.zip Link to comment Share on other sites More sharing options...
Sherzod Posted November 24, 2017 Share Posted November 24, 2017 Hi, Thanks for the testcase In this case just use like this: ... UniStringGrid1.ColCount := 20; for liX := 0 to 10 do begin UniStringGrid1.Columns.Add; UniStringGrid1.Columns[liX].Width := 60; //UniStringGrid1.JSInterface.JSCall(format(TitleJS,[liX, TitleJS]), format(TitleJS2,['Hello There'])); UniStringGrid1.Columns[liX].Title.Caption := 'New Title'+IntToStr(liX); //<---------------- end; ... Best regards, Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now