I have buttons for 'Products' on the dashboard. I have two different datasources DS_1 which gets list of 'CITY' and 'Products'. DS_2 gets data of 'Products' and related Sales. When I select any 'Product' button, I pass the parameter to DS_2 and load the datasource and get sales data only for one particular product to display in chart which is set to visible on selection of the button. However not always do all products have data in the database for a particular City, and sometimes, when I click a product button it passes the parameter to the datasource DS_2 and since there is no value of that particular Product sales in the database, dashboard is displaying prompt window to enter a new "Product' value.
I can get a default list of products from database; and If I can compare it to DS_1 data and check if a particular City has sales for these products I can keep the button active else I want to make the button inactive so the user knows that the button cannot be clicked since there is no data available for the selected city for a particular product.
I am thinking if I get the list of products for a city1 say ('a', 'b', 'c') and compare it with all products ('a', 'b', 'c', 'd', 'e') I will know that there is no data for product 'd' and 'e'. I would like to identify these two products and put in some method to leave the buttons inactive or display a message on the dashboard.
Please let me know if there is a way out using javascript difference between arrays or something.
Thanks a ton in advance.