GridJs show and hide images across tabs

Hi, I’m looking for a way to show/hide all images across all tabs in GridJs. However, when I set xs.sheet.data.images = null; in the beginning of xs.bottom.swapFunc it still sometimes renders the images and sometimes when I set xs.sheet.data.images at the beginning of swapFunc is still displays nothing. I’ve tried explicitly calling xs.reRender() and that doesn’t seem to have any effect. How can I have my worksheet show or hide images across all sheets? I want to be able to toggle images on and off even after the whole worksheet has been loaded.

@billkamm,

Could you please create a standalone sample project, zip the project and provide us to show the issue, we will check it soon.

I modified your example and the first context menu option now says “Hide All Images In Workbook”
image.png (12.4 KB)

If you click that it will hide all the images on the current worksheet, but when you click to Sheet2 the image is still there. If you click to Sheet 1 and come back to Sheet 2 then the images are hidden.

Clicking that context menu item again will toggle the images back to being shown, but when you switch tabs they are still hidden until you go to the tab for a second tab.

After setting xs.sheet.data.images to either the images to put back on the worksheet or null the subsequent tabs don’t render what is in the images collection until a second load. I have tried xs.reRender(); and that doesn’t seem to help. Can you help show me how I can make this toggle images on and off for the workbook work correctly?

@billkamm,

Thanks for the sample demo project, template file and screenshot with details.

I have logged a ticket with an id “CELLSGRIDJS-698” for your issue. We will investigate and look into the details of the issue. The issue is logged as following:
CELLSGRIDJS-698 - Issue with showing and hiding images across tabs using Aspose.Cells.GridJs

Once we have an update on it, we will let you know.

Please try the latest client side js v23.1.2,

we can set visible filter for image/shape

 // need to set a function which return true(for visible) or false(for invisible) for the visible filter with the below parameters :
	sheet:the sheet instance
	s:the image or shape instance
    for example: 
	//this will make visible for image/shape in sheet with name 'Sheet3' and 'Sheet1' except for the 'Rectangle' type
		xs.setVisibleFilter((sheet,s) => { if (sheet.data.name==='Sheet3'||sheet.data.name==='Sheet1') return s.type!=='Rectangle';  return false; })
	//this will make visible for image/shape in sheet with name  'Sheet1' 
		xs.setVisibleFilter((sheet,s) => { if (sheet.data.name==='Sheet1') return true;  return false; })
	//this will make invisible for image/shape in all sheets 
		xs.setVisibleFilter((sheet,s) => {  return false; })
	//if the all the image/shape is already loaded and you want to change the visible filter at runtime,you can call the below code to trigger a reload for image/shape
		xs.setActiveSheet(xs.getActiveSheet())

the correspond document will also updated soon in the document :

image.png (5.5 KB)

I receive the error message above when calling
xs.setVisibleFilter((sheet, s) => { return true; })

or

xs.setVisibleFilter((sheet, s) => { return false; })

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

  Issue ID(s): CELLSGRIDJS-735

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@billkamm can you provide your project for detail,we can not reproduce the issue.
and also your test spread sheet files

I was able to get it to work by making sure I only use setVisibleFilter after the xs.bottombar.swapfunc had finished running.

@billkamm
We are glad that your problem has been resolved.
If you have other questions, please feel free to contact us.