0

I have created view and I have added the fields like entity reference fields followed by content fields, then I added the entity reference field in filter condition, but its not displaying the table data. Following methods I followed to create the filter conditions,

1] created new view added the entity reference and other content fields.

2]added the contextual filters as shown in screen attachment, also the relationship as entity reference of the field.

3]in the left view page-> clicked on ->add filter condition->chosen the field and relationship but still its not able to filter the data of table please help me on this.thanks in advanceenter image description here

enter image description here

6
  • Please remove 'LAB ID' from contexual filter and then check.
    – deepa
    Aug 25, 2015 at 6:26
  • @deepa: i removed the lab id, but no changes its the same.
    – kashish
    Aug 25, 2015 at 7:16
  • remove from relationships too and check on page url.
    – vgoradiya
    Aug 25, 2015 at 7:20
  • @VimalGoradiya: i removed relationship too, its the same i am not getting why i am not able filter the data using entity fields.
    – kashish
    Aug 25, 2015 at 7:23
  • I am not understand why you want use entity reference in this view you already get LAB ID without referencing.
    – vgoradiya
    Aug 25, 2015 at 9:23

2 Answers 2

0

Have you tried Views Autocomplete Filters module ..it should be work for applying filter with view relationship.

To configure this watch the following tutorial by Daily Dose of Drupal "Watch here"

0

In my observation it appears you are mixing some configurations here. Normally when you add Content: Nid, you are telling the view to get the NID from your URL like animal-info-view/% where "%" represents the node ID or somewhere else like Panels but notice that you don't have that. The view will now be asking "Where is my nid? I can't find it.". So now you're having issues with no data being displayed.

If you need a listing page, sometimes you won't need the Contextual and Relationship fields anymore. Just directly add the entity reference field into Filter Criteria and it should look like the Gender filter.

If you need a content/node view page, now you will need the Contextual fields but kinda not need the filter because you're just displaying one content.

EDITED

Apologies for the late reply. So on my research I found a module called Views Reference Filter that enabled you to assign a View to provide the selections for your filter. So install an enable the module.

Create the Entity Reference filter view

  1. Create a new View.

  2. Add a new Views Display called Entity Reference.

  3. Select the Lab content type for the Show field.

  4. Add the Lab Nid and Title/Name.

  5. Under Format, replace it with Entity Reference List

  6. Under the format's settings, choose Nid for Search fields.

    You should have something like: enter image description here

Tweak your Animal Info View

  1. Remove all the Contextual filters and Relationships you have and the (Content entity referenced from field_lab_idc) Content: LAB ID filter you added.

  2. And add the Content: LAB ID field that's in your Animal Info content type

  3. On the LAB ID's settings pop-up, you will notice something new, it's the View used to select the entities. Select the entity reference view that we created a while ago.

  4. You can leave the default Operator setting to Is one of.

  5. Check the Expose this filter to visitors, to allow them to change it.

    This would look like: enter image description here

  6. And click Apply.

    Your Animal Info View should have something like this: enter image description here

Hope this helps you.

NOTE: Please include your requirements so that people would know what you want the result to be like.

7
  • @ Leolando Tan:Thanks, but i tried to add directly like as you mentioned but its not showing the table data again.
    – kashish
    Aug 25, 2015 at 7:14
  • Oh! :( What is your requirement for this View? Is it a listing page or a single content page? Aug 25, 2015 at 13:56
  • @ Leolando Tan: listing of created content fields.where in i have fields type like entity reference, text, date.
    – kashish
    Aug 26, 2015 at 5:56
  • @kashish I see and Lab ID referenced is just another node right? I'll try to replicate your setup and update my answer. Aug 26, 2015 at 9:01
  • @kashish I added a guide on my solution. Hope it helps. Aug 28, 2015 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.