rhennink Posted October 10, 2017 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 Quote
Sherzod Posted October 11, 2017 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 Quote
mos Posted November 24, 2017 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; Quote
mos Posted November 24, 2017 Posted November 24, 2017 Hi Delphi Developer, Attached is a test case. Project.zip Quote
Sherzod Posted November 24, 2017 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, 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.