Jump to content

Javascript Execution after populating TUniStringGrid


mos

Recommended Posts

I have an application that populates a TUniStringGrid dynamically and the data is loaded based on the selected item from a specific list.

Which could be solved by any of the 2 situations below:

1. How can I execute a line of JS code? or
2. How can I hide a column completely? Since there is no Visible property in Columns (only used Columns.width := 0)

 

To elaborate:

1. The javascript is like this,

$('.test').each(function () {
    $(this).css('display', $(this).width() == 0 ? 'none' : '');
});

I've tried UniStringGrid.JSInterface.JSCode('code here');

But it doesn't run.

Alternatively, I've also used the ClientEvents.ExtEvents property, but this only works on the initial loading (placed on afterlayout) but when the data is changed, doesn't run anymore.

2. The columns appear as the image below

image.png.c2dc14a741ebf2c29dc9404fab006d76.png

Either solution to the 2 problems above would be great!

Thanks!

Link to comment
Share on other sites

2 minutes ago, Sherzod said:

Hi,

Maybe I don't fully understand what you want,

In addition..., you can also use this JS event:


function store.datachanged(sender, eOpts)
{
    //
}

 

Hi,

It's actually either one of the following:

1. Where or how can I run the javascript I need to run? or
2. How can I hide a column completely? There is no visible property in columns

Link to comment
Share on other sites

17 minutes ago, mos said:

2. How can I hide a column completely? There is no visible property in columns 

Maybe something like this:

// for example, the second column

UniStringGrid1.JSInterface.JSCall('getColumns()[1].setHidden', [True]);

 

Link to comment
Share on other sites

14 hours ago, Sherzod said:

Also, you can try this approach:


function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts)
{
    columns[1].hidden=true;
    sender.getView().refresh();
}

 

Hi,

Will try this approach

Link to comment
Share on other sites

17 hours ago, Sherzod said:

Also, you can try this approach:


function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts)
{
    columns[1].hidden=true;
    sender.getView().refresh();
}

 

Hi Sherzod,

It works! But as I change and change the data (via selecting from a list that reloads to grid), it wont work anymore? :huh:

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...