Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
6.x-3.x-dev
Component:
Views Integration
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Dec 2010 at 23:52 UTC
Updated:
25 Jun 2015 at 12:48 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dawehnerMove to noderef, there is no reason in views that it doesn't work, from my perspective. CCK might do something wired here.
Comment #2
nicksanta commentedI've been trying to debug this issue for @boabjohn. It took a while, but I think I've shed a little light on the issue (although haven't found the root cause).
Currently using the following versions of modules:
Views: 6.x-3.x-dev [11 Dec 2010]
Node Reference: 6.x-3.x-dev [6 Dev 2010]
OK, so the problem was that no matter how many items the view was configured to display, it always showed 10 in the nodereference widget. No matter what widget was selected, how many values the field was configured to save etc..
I traced the issue down to the views_plugin_query_default::execute() function. Here are the bits that I was interested in.
So, for whatever reason, the $this->limit was being assigned the value of 10 at some point after:
$replacements = module_invoke_all('views_query_substitutions', $view);But before this:if (!empty($this->limit) || !empty($this->offset)) {Anywho, I added a hook in the site's custom module to get around the issue temporarily. See below if anyone else is stuck:
Comment #3
dbkern commentedI have the exact same problem. I've tried the code from #2 in a custom module but I can't get it to work. Don't know what I am doing wrong. Changed view_name to the name of my view. Anything else I should be doing?
Comment #4
dbkern commentedWell, I'm an idiot--or sleep-deprived. I had a typo in my function name.
Nicksanta, thanks so much for the code--it works splendidly and puts to rest a couple of days of agony trying to pinpoint this problem. My problem was actually with a Webform and the Webform View Reference Component which is based on CCK Nodereference. I couldn't control the number of nodes displayed in my select list--always ten. Traced it back to CCK but don't know php well enough and couldn't solve it.
Again, big thanks!
Comment #5
nbecher commentedwhat was the typo you had? I am trying to get this to work as well and changed the view name. It's still not working. did you change anything else?
thanks so much.
Comment #6
monotaga commentedHas anyone figured out anymore about this issue? Any better workarounds beside adding code to a custom module?
Comment #7
monotaga commentedThis does seem to have something to do with the version of Views in use since downgrading to Views 6.x-3.0-alpha3 doesn't cause this problem.
Comment #8
rp7 commented#2 wasn't working for me either. Following code however, does work on my installation. You might want to give it a try:
Comment #9
raveman commentedhook_views_query_alter helped me with the same issue
Comment #10
btown commentedThe solution in #2 worked for me.
Comment #11
916Designs commented#8 Worked for me.Thank you both.
Comment #12
Renee S commentedConfirm #8 worked. (#2 did not.)
Thanks all :)
Comment #13
VTM commentedcan anyone help me with more clear instructions?
Where do I add the above code (#2, #8) ?
thanks.
Comment #14
rp7 commentedYou should put it in a custom module. (http://drupal.org/developing/modules)
Change 'mymodule' in function mymodule_views_query_alter with the name of your module.
Change 'name_of_view' in if($view->name == 'name_of_view') with the name of your view.
Hope that helps?
Comment #15
hixster commentedIs there a more permanent solution to this on the horizon ? Grateful for the solution, but having to maintain a separate module to fix this issue alongside all the other code on a site seems like a pain.
Comment #16
nicksanta commented@hixster: Comes with the territory of using alpha / dev versions of code on your site.
Comment #17
cossme commentedi put together a small module using #2 which does the trick for me. I attached it so it might be of any help for somebody. after installation just go to admin/settings/cossme_fix_noderef and enter the ids of views to be "fixed".
Comment #18
mirabuck commentedIt looks like cossme and I were working on this in parallel. I've put together a module to address this as well. Took a different route though, creating a CCK widget that allows the view limit and arguments to be overridden when adding new nodes. It can be found at here: http://drupal.org/project/limited_nodereference
Comment #19
bkno commented@cossme
Just trying the module in #17. I've added two views, one on each line, but only the last one seems to get fixed. What I've put in the box:
My_View_Name_One
My_View_Name_Two
Assuming by ID it's the 'machine' name. I also tried the numerical ID but this doesn't seem to do anything.
UPDATE:
I've amended the cossme's module line 25 to:
$select_views = split(",", variable_get('cossme_fix_noderef/views', ''));Splitting on comma instead of new line now makes the views show more than 10 items in the select list. I'm now entering like:
My_View_Name_One,My_View_Name_Two
Hope CCK module can resolve the underlying issue though. I'm using latest CCK stable with Views dev.
Comment #20
fourmi4x commented#8 worked for me, thanks!
However, I wanted to mention that I went on this thread because of another "problem" : I didn't know that one had to put a "nid" field in the target view in order for the "Advanced - Nodes that can be referenced (View)" option to work (Without the nid, I always got only 1 node!).
I stuck on this for about 2h...couldn't find the info anywhere! I think it would be a good idea to add this info ("nid required") in the help text of the "Advanced - Nodes that can be referenced (View)" section, like:
Choose the "Views module" view that selects the nodes that can be referenced.
Note:
* Only views that have fields will work for this purpose.
* This will discard the "Content types" settings above. Use the view's "filters" section instead.
* Use the view's "fields" section to display additional informations about candidate nodes on node creation/edition form.
* Use the view's "sort criteria" section to determine the order in which candidate nodes will be displayed.
* The target view must have a "Node: Nid" field.
for instance... Or at least put this in the advanced help...
Comment #21
zhangtaihao commentedThis issue applies to both Node Reference and User Reference. I understand my post is probably not going anywhere, but here's the idea anyway. Hopefully, this gets around the "potential instability" of Views 6.x-3.x-dev transparently.
Comment #22
VTM commented@zhangtaihao - thanks.
It did help.
Comment #23
travist commentedI just ran into the same issue... debugged it on my own, and practically came up with the same solution here #1015810: nodereference select shows only the first 10 rows from view .
So, this patch is reviewed and tested by the community. Good fix.
Comment #24
travist commentedAlso created a patch for Views that should fix this particular case, but the patch above is still needed. #1243436: Advanced View with "none" pager limits view results
Comment #25
monotaga commentedThe patch in #21 is also working for me. Can we get it rolled in?
travist, I'm not completely understanding the purpose of your patch at #1243436: Advanced View with "none" pager limits view results; that's an independent issue, right? Ie. I don't necessarily need to use your patch there if the patch here in #21 fixes my issue, right?
Comment #26
travist commentedmonotaga,
The patch I did for views is not necessary to fix this particular case since the node reference module explicitly sets the number of items to 0 (infinite). So, all you really need is #21 and it will fix this issue. I included the work I did on #24 because it was related and was the cause of the original issue.
Comment #27
liquidcms commented#21 worked for me (once i got rid of the crud that git adds to patch file)
not sure why this hasn't been committed yet.
Comment #28
christianchristensen commentedSecond what @liquidcms said, the patch does not apply cleanly, a quick removal of the a/ and b/ directories seems to help.
Comment #29
xpersonas commentedAfter uploading to Views 6.x-3.x-dev (2011-Nov-10) this patch is no longer working for me. Anyone else have that issue with this version of Views? I know it was this version because it worked fine until upgrading just this module.
Comment #30
hillaryneaf commented@phaedo5 Try upgrading to Views 6.x-3.0-rc3 (2011-Nov-14). The patch worked for me with the release candidate of Views.
Is there a reason the patch hasn't been committed?
Comment #31
iamsixstringz commentedTHANK YOU for this comment, it just saved my day!!
I accomplished this by adding a node id by creating a page display for the view, and defining it's path. Didn't see a variable named NID as you mentioned above.
Comment #32
jparets commentedI have the same problem when upgrading from Views 6.x-2.16 to views 6.x-3.0
I experienced the same problem in the past and it was solved setting appropiate validators for arguments in Views. But this solution do not work now.
The views works fine when are displayed, but the number of items is restricted to 10 in editing forms. The main drawback is that nodes can not be edited or created when they contain nodereference fields.
Thanks!
Comment #33
slybud commented+1 for patch in #28, it solved my issue with 3.0-rc3 version of views
Thanks everyone
Comment #34
monotaga commentedThis patch has been RTBC for a while now. Could we please have this applied?
Comment #35
Azol commentedPatch in #28 applies to 6.x-3.x-dev cleanly.
+1 RTBC
Comment #36
terbs commentedPatch has also worked for me..
Comment #37
danny englanderJust getting back to a site that needed some attention and this fix in particular. The patch in #28 worked thankfully but as others have reported there were issues using
git apply. I had to remove the git stuff and use the oldpatch -p0 <method, Thanks to all who worked on this and again not sure why this has not been applied to the dev yet. At any rate I used the latest dev 3.x from 2012-Jan-12 and applied cleanly.Comment #38
deggertsen commentedThanks for the patch. Fixed the problem for me as well. I vote that this be committed.
Comment #39
Azol commentedMaybe someone would reach KarenS via e-mail or IRC, I tried to PM her a while ago to no avail.
Comment #40
jeebsuk commentedWe are also suffering with this problem - any chance of getting this patch committed?
Comment #41
yched commentedAdded a comment, and committed to both 2.x and 3.x branches.
Thks folks !
Comment #42
jeebsuk commented@yched: Have already expressed my gratitude on this via Twitter, but many thanks for your help on this after I got in touch, very grateful indeed.
Comment #43
Azol commentedMany thanks!
Comment #45
dpatte commentedThis issue seems very closely related to #1166234: Field values aren't displayed when using Views to filter node reference select list (/w Fix) but the latest dev of cck 6.2 don't resolve this issue for me.
Comment #46
pvasener commentedI'm using patch #28 successfully for a few months now, as a few of us, but it doesn't seem to be into views-6.x-3.x yet.
Comment #47
damienmckenna