Jump to content

Rating widget column


Sherzod

Recommended Posts

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  //for example
  with UniDBGrid1, UniDBGrid1.Columns[4].WidgetColumn do
  begin
    Enabled := True;
    AutoPost := True;
    Widget := UniSliderWidget1; //At the moment, we need to use an already existing widget (more precisely, UniSliderWidget), and change its type to another...
    JSInterface.JSConfig('xtype', ['rating'], Widget.JSControl);
    JSInterface.JSConfig('overStyle', ['color: orange;'], Widget.JSControl);
    JSInterface.JSConfig('scale', ['150%'], Widget.JSControl);
  end;

end;
initialization
  ...
  UniAddCSSLibrary('build/packages/ux/classic/classic/resources/ux-all.css', False, [upoFolderJS, upoPlatformDesktop]);
  UniAddJSLibrary('build/packages/ux/classic/ux.js', False, [upoFolderJS, upoPlatformDesktop]);

 

  • Thanks 1
Link to comment
Share on other sites

  • 5 months later...

Hi Sherzod,

I tried this but it don't work. The DBGrid don't appear at all. I use UniGUI 1.95.0.1580.

On 12/20/2023 at 8:31 PM, Sherzod said:
procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  //for example
  with UniDBGrid1, UniDBGrid1.Columns[4].WidgetColumn do
  begin
    Enabled := True;
    AutoPost := True;
    Widget := UniSliderWidget1; //At the moment, we need to use an already existing widget (more precisely, UniSliderWidget), and change its type to another...
    JSInterface.JSConfig('xtype', ['rating'], Widget.JSControl);
    JSInterface.JSConfig('overStyle', ['color: orange;'], Widget.JSControl);
    JSInterface.JSConfig('scale', ['150%'], Widget.JSControl);
  end;

end;

 

 

The DBGrid and the UniSliderWidget works normally as expected if I delete the 3 JSInterface lines above.

Thank you

 

Link to comment
Share on other sites

No, I tried in my own application.

I have an integer field that I use for rating (0-5), so I tried the code to make it look like star rating.

No error is displayed.

Link to comment
Share on other sites

Hi Sherzod,

 

It does not work with the demo \Demos\Desktop\Grid - WidgetColumn2.

It will look like this:

image.thumb.png.3f4acf5d8ad1017c798aafe463844cbd.png

 

If I comment out these 3 lines:

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniDBGrid1, UniDBGrid1.Columns[4].WidgetColumn do
  begin
    Enabled := True;
    AutoPost := True;
    Widget := UniSliderWidget2;
    //JSInterface.JSConfig('xtype', ['rating'], Widget.JSControl);
    //JSInterface.JSConfig('overStyle', ['color: orange;'], Widget.JSControl);
    //JSInterface.JSConfig('scale', ['150%'], Widget.JSControl);
  end;
end;

 

Then it will look normal like this:

image.thumb.png.5b1a8f2fe190d1f037d10a3cc35699d3.png

Link to comment
Share on other sites

  • 2 weeks later...
2 hours ago, jrp said:

Have you check this?

Forgive me for my forgetfulness...

Can you try add these lines in initialization section? 

initialization
  ...
  UniAddCSSLibrary('build/packages/ux/classic/classic/resources/ux-all.css', False, [upoFolderJS, upoPlatformDesktop]);
  UniAddJSLibrary('build/packages/ux/classic/ux.js', False, [upoFolderJS, upoPlatformDesktop]);
  • Like 1
Link to comment
Share on other sites

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...