View is returning random results when no filter is selected in Drupal. Why? - view

In drupal I have created a view to display node's title and added exposed filter for filtering content. When the view page is loaded it is returning two nodes, I do not know on what basis it is returning those two nodes. I want no result to be displayed until I select some value in filter. Please suggest?

Views is a query builder that starts with the simplest, broadest possible query, and filters are required to narrow that query to include only the items you wish. If you are familiar with SQL syntax, the default query would look something like this:
SELECT title, body FROM 'node'
This is why you're seeing two nodes when you load the page. There's no filter applied, so it's showing everything.
In order to get your View to only display items once the user has selected a value with the exposed filter, go into the Advanced > Exposed Form > Exposed Form Style and select Input required. I have tested this using Views 7.x-3.7 and I believe it will give you the behaviour you're looking for.

Related

Hide/remove options from a view's grid header filtering

I've been looking for an approach to remove unwanted values from a views grid column filtering dropdown but I'm not sure if its even possible.
A specific view in our app only displays results where the column will contain 5 values, however the column option set has 20+. Is it possible to remove the unwanted 15 values from being displayed when the view's filter by function is used?
This documentation does not mention any way the values can be hidden.
I have added a web resource to a view column before, to change text values into an image, however I don't think this is an applicable place to add a script to hide filter by values.
I have developed plugins so not against using this medium if the approach works and does not introduce a performance hit.
Unfortunately that header filter is not open for customization/configuration. Though MS mention it as Excel like filter, it is not going to give the filter options for only values from current list. It will load the full options list.
When we had such requirements in the past - we have developed a PCF control with grid + filters and used it instead.

How to Get PowerBi Embeded Report's Filters' Options

We are trying to hide the native filter panel of the embeded powerbi report, and create a toally new look filter panel aside the embeded powerbi report with ourselves html and js code.
The problem we have is how do we get all the options of a filter? we need to get the options of a filter so that we can populate them on custom filter panel.
I find the powerbi client js sdk as a method "getFilters" of a report, but the filter values is empty unless we check all the options on the powerbi native fitler panel manually.
How can we get any filter available options?
The getFilters method returns the filters currently applied to the object (can be a report or a page). That's why it will be empty if no filter is applied.
For the how to get all the options of a filter part, the short answer is such thing doesn't exist.
There are two types of filters in Power BI, Basic and Advanced. Basically, any column in any of the tables in the data model can be set as a filter target, even though it's not used in the visuals. And the filtered values can be any value compatible with the column data type. Thus, there are many, if not infinite combinations of filters.
Instead, you can check how to construct filters to set meaningful filters to the report or page. Or best, adding slicers to the report during the report building phase.

Action filters across dashboards without switching sheets in Tableau 9.2

In Tableau 9.2, how can I use a filter which filters from one dashboard to another so that when I trigger it, it does not switch dashboards? I have found this answer online, yet the poster cautions that their method should only be used for V7 and not V9.
Create another action as a filter in the sheet you want to stay in and select all of the dashboards as source and target. As this is the newest action it should make you stay in the same sheet while you keep applying different filters to your data.
In the Dashboard Menu go to Actions and add a Filter,in the filter select source dashboard and select other dashboard as target.This will redirect you to different tab.
You could use a parameter along with calculated fields, or use the JavaScript API
Filter actions also change to the target sheet or dashboard, if not already in focus (as you found out)
If you are doing single selection and your list of values is relatively stable, you could use a parameter instead -- loading the initial values from your field. And then define calculated fields that access the parameter value and use those fields on filter shelves as desired.
Changing a parameter value does not change the view to a target sheet -- unlike a filter action.
The downside of this approach is that the parameter values are not loaded dynamically from a data source and that parameters can only have a single value.
Another option could be to use the JavaScript API in some way. You could listen for changes to the selection, and take whatever action you want in response. That only works if you publish to Tableau Server, and you may want to then pull out some of the navigation controls into your own HTML/CSS -- say to filter the second dashboard just before switching to it.

COLDFUSION CFGRID Datapass with a post

I have a bit of a unique challenge today. I have a client that wants to be able to search for multiple items based on inserts into a cfgrid. Suppose we have the following web form:
A Country selection dropdown
A State Selection dependent AJAX dropdown
A city Selection dependent AJAX dropdown
An ADD Button
----------------------------------------------------
A CFGRID that will populate a row with selections when the user clicks the add button
----------------------------------------------------
And finally, a CLEAR button, and a GO button on the bottom.
The resulting page will then query the database and get some statistics about the cities selected. So, suppose an individual picks USA > Arizona > Scottsdale and USA > Arizona > Flagstaff. The grid below the options will 'save' each selection and reset to their default options, waiting for a user to pick additional options or click on 'GO'.
The resulting page will then generate columns that list some statistics about the communities and highlight the 'best of' between each selected community.
Each time a user selects the ADD button (assuming three criteria are selected) I want the information to be added into a CFGRID that displays the options selected. Then, After the user selects at least one country/city/state option, have all of the data in the CFGRID get passed to another page that does a query from the data selected. In theory, the user could pick as many communities as they want, assuming they are willing to let the database sludge through enough data to get what they want and wait through a 'loading' screen to get it.
I'm having these challenges, in no particular order:
- I have an HTML grid that I must use per client spec (No Java or Flash, must be HTML)
- I have no idea how to get the selected options into the CFGRID. I assume there is some JavaScript I can write that uses some sort of AddRow function to add data into the grid with the add button but cannot seem to find how to it on the interwebs
- After we conquer the above challenge, how do I pass the data from the grid into the results page? I thought about passing one big string or a structure, but I'm not sure how to do that through the URL or posting, nor how to get the data out of the grid. I wonder if I am better off coding some sort of string that gets passed from the options page to the results page with a get method instead of dealing with the stuff in the CFGRID and have the CFGRID serve only as a 'dummy' display container.
- Finally, after the pass is complete, I would need to loop through through the structure and perform a CFQUERY or CFSTOREDPROC on each row of data, then get the statistics I need to display on the results page. I assume this would depend on how I am getting the data from the options selection page to the results page.
THANK YOU ALL!
CFGRID is great to start, but it can be b*tch to customize and extend... Have you tried editable CFGRID with bind? See how far off it is from what you want first. If it turns out to be very far, then you might want to go for a jqGrid and code up some jQuery.
To start, read Using HTML grids and make the cfgrid editable.
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7a01.html#WSc3ff6d0ea77859461172e0811cbec22c24-72e0
Once you got that working, look at these provided JS functions that you can use with CFGRID
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WS0ef8c004658c1089-6262c847120f1a3b244-8000.html
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSd160b5fdf5100e8f-4439fdac128193edfd6-7f5f.html
If you still demand a bit more, you might need to dig into the underlying ExtJS component. At that point I would rather use jqGrid
I found out that the best way to handle this was by using a SerializeJSON call and a Deserialize JSON call back and forth. By using JavaScript notation we are able to pass a complex JavaScript object (array) between one page and another. This has the value add of not having to worry about sessions timing out and making URLs clickable from one solution to the next.

Drupal View - load more with ajax

I have a View (block display) listing node titles of a certain content type displaying the latest 12 published items. It displays underneath all nodes of a specific type.
What I'd like to do is be able to load the next 12 items with AJAX (I know the pager does this but I was hoping to avoid it) and also control the offset based on the node title.
I think the second request can be achieved with the row number in the query but so far I'm having trouble achieving a working script.
you always can call view results from Drupal API:
$results = views_get_view_result('my_view',$display, $args)
and in arguments you can pass start/end number of items, or something else, depends how you sorting your results
Well, instead of that work, how about selecting the mini pager? I'm pretty sure it only shows previous and next links. If it's not the exact display you want to use, you can override theme_views_mini_pager (from views/theme/theme.inc, line 636) to only show what you need.

Resources