Need a special offer?Find out if your project fits.
+

Customise default slice

Answered
Paul Pollard asked on October 11, 2018

Hi,
I'm new to flexmonster so I'm sure I'm doing something silly but I can't get it to display a custom slice on page load.
Here's what I'm doing:

  1. I took the generic initialisation from a JSFiddle
  2. Customised it to use my license etc
  3. Loaded the data into flexmonster, re-arranged it to my liking and clicked save
  4. Opened the resulting .xml file and copied the slice object
  5. Pasted into the generic initialisation

When I load the page, it shows the default slice and I'm not quite sure why:

var pivot = new Flexmonster({
	container: "pivotContainer",
	componentFolder: '/flexmonster/',
	toolbar: true,
	licenseKey: "MY KEY",
	report: {
		dataSource: {
			dataSourceType: "json",
			filename: "/src/reports/dataset",
		},
		"slice": {
			"rows": [{
					"uniqueName": "GROUP A"
				},
				{
					"uniqueName": "GROUP B"
				},
				{
					"uniqueName": "GROUP C"
				}
			],
			"columns": [{
				"uniqueName": "[Measures]"
			}],
			"measures": [{
					"uniqueName": "COL1",
					"aggregation": "sum"
				},
				{
					"uniqueName": "COL2",
					"aggregation": "sum"
				},
				{
					"uniqueName": "COL3",
					"aggregation": "sum"
				},
				{
					"uniqueName": "COL4",
					"aggregation": "sum"
				},
				{
					"uniqueName": "COL5",
					"aggregation": "sum"
				},
				{
					"uniqueName": "COL6",
					"aggregation": "sum"
				}
			]
		}
	}
});

As I said, I'm sure I'm doing something silly, but there's no console errors and everything else seems to be working correctly so I'm not quite sure what - any help would be appreciated!

 
Thanks

4 answers

Public
Tanya Gryshko Tanya Gryshko Flexmonster October 11, 2018

Hi Paul!
Thank you for the detailed explanation.
I have to say that don't see any mistake in your description. It looks like you are doing everything correctly. I can recommend you to check if you are changing the right file in the right folder. It's my personal favorite mistake that I did many times 🙂
Regards,
  Tanya

Public
Paul Pollard October 11, 2018

Hi Tanya,
 
Thanks for the confirmation, though it's a shame I haven't made a silly mistake!
I'm confident that it's the right file that's being edited as if I remove the key I get an error message. Is there anything else you think might be worth trying?
Something I didn't mention in the original post is that I'm currently using a trial key (with intent to purchase if it suits our needs), but this page suggests that it shouldn't be an issue - "The component runs with a trial key without any restrictions, with all capabilities according to the downloaded edition".
I'll see if I can get it working using the exact example in the JSFiddle and get back to you if that does/doesn't work.
 
Regards,
Paul

Public
Paul Pollard October 11, 2018

Hi again,
I've made some progress - I have a call to update the data (this is attached to a filter which is too intensive for JS processing):

pivot.updateData({
	dataSourceType: "json",
	filename: "/src/reports/dataset?" + serialisedInputs,
});

When the page loads, this is called immediately (to fetch any pre-filtered data) - I'm not sure if this is a small bug with flexmonster:

  1. Page loads, flexmonster is initialised with custom slice
  2. pivot.updateData is called elsewhere on the page, also at page load
  3. Table is loaded with default slice, rather than the custom slice added in initialisation

I think I can get around this, but let me know if you think that this is a bug and would like more information to help fix it (if necessary)
 
Regards,
Paul

Public
Tanya Gryshko Tanya Gryshko Flexmonster October 12, 2018

Hello, Paul,
Thank you for this detailed description.
When the component in the initialization phase, using API calls may cause unexpected results. We recommend using any API calls after the reportcomplete event is fired. Using updateData this way wouldn't interfere with the custom slice.
I hope this information would be helpful.
Regards,
Tanya

Please login or Register to Submit Answer