Jump to content


Photo

StringGrid Questions


  • Please log in to reply
45 replies to this topic

#1 mos

mos

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 161 posts

Posted 04 December 2017 - 01:12 AM

I have a number of questions:

 

  1. Is there a way of preventing the user from resizing the column below a minimum column width value so that the column is always visible?
  2. Is it possible to drag and drop columns to change the ordering of the columns in the grid?
  3. How can rows be sorted in ascending/descending order based on the column that is clicked?  I have seen sorting code based on the VCL stringgrid which uses the Rows property and a temporary TStringList to perform the exchanging of the rows however the uniGUI stringgrid does not have this property.

  • 0

#2 mos

mos

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 161 posts

Posted 08 December 2017 - 03:19 AM

Just bumping this.

 

Also I have another question:

 

    4.   How can I update the UniCellAttribs of a cell without using OnDrawCell event?  e.g. I have a timer which runs and I want to update a particular Cell background color based on a certain condition.


  • 0

#3 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 08 December 2017 - 03:25 AM

Hi,

We will check,

For 2, 3: maybe you need to use uniDBGrid
  • 0

#4 mos

mos

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 161 posts

Posted 13 December 2017 - 01:36 AM

Bumping this one again.

 

Any further updates on the items above specifically item 1 and 4?


  • 0

#5 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 13 December 2017 - 04:48 AM

Hi,

 

Bumping this one again.

 

Any further updates on the items above specifically item 1 and 4?

 

Do you use FixedCols ?!


  • 0

#6 mos

mos

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 161 posts

Posted 13 December 2017 - 06:23 AM

Hi Delphi Developer,

 

  FixedCols is set to 0.


  • 0

#7 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 13 December 2017 - 06:49 AM

Ok, I will try to analyze
  • 0

#8 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 13 December 2017 - 06:23 PM

Hi,

 

4.   How can I update the UniCellAttribs of a cell without using OnDrawCell event?  e.g. I have a timer which runs and I want to update a particular Cell background color based on a certain condition.

 

One possible solution,

Can you try to use this approach?:

 

For example for Row=0 (tr:nth(1)) and Column=0 (td:nth(1))

 

nth(n) (1 based)

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  with UniStringGrid1.JSInterface do
  begin
    JSCode(#1'.normalGrid.getView().el.select("tr:nth(1) td:nth(1)").elements[0].style["background-color"]="green";');
    JSCode(#1'.normalGrid.getView().el.select("tr:nth(1) td:nth(1)").elements[0].style["color"]="white";');
  end;
end;

Best regards,


  • 0

#9 mos

mos

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 161 posts

Posted 13 December 2017 - 11:41 PM

Hi Delphi Developer,

 

  I seem to be getting some sort of Ajax error.

 

  See attached screenshot.

Attached Files


  • 0

#10 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 14 December 2017 - 01:23 AM

Hi,

Which build are you using?
  • 0

#11 mos

mos

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 161 posts

Posted 14 December 2017 - 03:51 AM

Hi Delphi Developer,

 

  Build 1413.


  • 0

#12 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 14 December 2017 - 05:21 AM

Hi,

 

Hi Delphi Developer,

 

  I seem to be getting some sort of Ajax error.

 

  See attached screenshot.

 

If it's not difficult for you, please make a test case


  • 0

#13 mos

mos

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 161 posts

Posted 14 December 2017 - 05:48 AM

Hi Delphi Developer,

 

  Attached is a test case that generates the Ajax error.

Attached Files


  • 0

#14 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 14 December 2017 - 06:20 AM

Ok,

 

Try this:

  with UniStringGrid1.JSInterface do
  begin
    JSCode('var view, me='#1'; if(me.normalGrid) {view=me.normalGrid.getView()}else{view=me.getView()}; view.el.select("tr:nth(1) td:nth(1)").elements[0].style["background-color"]="green";');
    JSCode('var view, me='#1'; if(me.normalGrid) {view=me.normalGrid.getView()}else{view=me.getView()}; view.el.select("tr:nth(1) td:nth(1)").elements[0].style["color"]="white";');
  end;

  • 0

#15 mos

mos

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 161 posts

Posted 14 December 2017 - 11:18 PM

Hi Delphi Developer,

 

  If I put some code to set the cell text before the two JSCode lines the cell colors appear correctly.

  with UniStringGrid1.JSInterface do
  begin
    UniStringGrid1.Cells[0,0] := 'test';

    JSCode('var view, me='#1'; if(me.normalGrid) {view=me.normalGrid.getView()}else{view=me.getView()}; view.el.select("tr:nth(1) td:nth(1)").elements[0].style["background-color"]="green";');
    JSCode('var view, me='#1'; if(me.normalGrid) {view=me.normalGrid.getView()}else{view=me.getView()}; view.el.select("tr:nth(1) td:nth(1)").elements[0].style["color"]="white";');
  end;

  If I put the line after the two JSCode  lines the cells don't have the colors applied.

 

  Is there a reason why the colors are not applied if the UniStringGrid1.Cells[0,0] := 'test'; is after the two JSCode lines?


  • 0

#16 mos

mos

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 161 posts

Posted 15 December 2017 - 03:17 AM

Hi Delphi Developer,

 

  I tried to create a TUniStringGrid in code and then used the JSCode lines you gave me but I get an Ajax Error.

 

  I have attached a sample test case.

Attached Files


  • 0

#17 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 15 December 2017 - 03:26 AM

Hi,

Ok I will check it
  • 0

#18 mos

mos

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 161 posts

Posted 18 December 2017 - 04:25 AM

Hi Delphi Developer,

 

  Any update?


  • 0

#19 mos

mos

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 161 posts

Posted 22 December 2017 - 10:34 AM

Hi Delphi Developer,

 

  Still waiting for some sort of update.


  • 0

#20 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4754 posts

Posted 22 December 2017 - 10:39 AM

Hi,

 

Sorry for the delay, I will try to find a workaround

 

Best regards,


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users