Here i selected 3 filters 1 from each chart and pasted that encoded url in url param. but when i press decode url button it is redrawing only middle chart filters but not the remaining once.. what should i do? thanks
function encodeFunction()
{
var filters = [];
for (var i = 0; i < dc.chartRegistry.list().length; i++)
{
var chart = dc.chartRegistry.list()[i];
for (var j = 0; j < chart.filters().length; j++)
{
filters.push({ChartID: chart.chartID(), Filter: chart.filters()[j]});
}
}
var urlParam = encodeURIComponent(JSON.stringify(filters));
alert(urlParam);
}
function decodeFunction()
{
//encoded url here
var urlParam="%5B%7B%22ChartID%22%3A1%2C%22Filter%22%3A2012%7D%2C%7B%22ChartID%22%3A2%2C%22Filter%22%3A%5B1.0454545454545454%2C4.045454545454545%5D%7D%2C%7B%22ChartID%22%3A3%2C%22Filter%22%3A%22Mr%20B%22%7D%5D ";
var filterObjects = JSON.parse(decodeURIComponent(urlParam));
for (var i = 0; i< filterObjects.length; i++)
{
dc.chartRegistry.list()[filterObjects[i].ChartID-1].filter(filterObjects[i].Filter);
}
// dc.renderAll();
dc.redrawAll();
}
here is the fiddle: js fiddle link