Jump to content

Recommended Posts

Posted

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!

Posted
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

Posted
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]);

 

Posted
35 minutes ago, Sherzod said:

Maybe something like this:


// for example, the second column

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

 

Hi, tried this but i get an error

image.png.788181bd59e1bbedadab43f6df4a2662.png

Posted
48 minutes ago, mos said:

tried this but i get an error 

Also, you can try this approach:

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

 

Posted
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

Posted
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:

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