Postponed
Project:
Views Custom Field
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 May 2009 at 02:05 UTC
Updated:
18 Oct 2010 at 20:41 UTC
Hi,
Is possible to have a custom field that removes the row from a table if some conditions are met?
Thanks,
introfini
Comments
Comment #1
casey commentedNope, but I'll think about it.
Comment #2
introfini commentedThanks!
That way we can for example make group by queries...
introfini
Comment #3
sidharth_k commentedsubscribing. Need this feature too.
Comment #4
bfr commentedHere is my "delete" button i just got working(adds button to each row to delete node. You can change the button condition to anything else you want:
Any ideas how i could refresh the view after this(as you can see, now i have to use the "removed" text to inform that the row will be gone after next refresh)?
Also, can the "node blahblah has been deleted" text be disabled somehow?
Comment #5
hatsch commentedi need the same feature on a site. what i do for now is setting all the $data->field variables to 0 so they don't show up at least...
deleting the row from the view would be much nicer.
btw: i don't think #4 has a solution to the problem. it's not about deleting the node, but deleting the row of the view.
Comment #6
bfr commentedWell, if you just want to remove one row from showing, why dont you just use normal views filters?
For example, make "remove" check box cck field to node and add that to filters.
Or check if content of some field is empty, then filter out the entry.
Comment #7
hatsch commentedbecause views filter do not offer what i need in this situation.
i have a field called length which holds the length of an uploaded video. the view should only show so many videos that a given total length is not exceeded.
in my Views Custom Field i calculate the sum of these lengths. thanks to the $static variable i can easily pass the value from one row to another.
when $static is bigger than i want, the row should be "destroyed" so they are not included in the final view.
what i do now is setting all the values to 0 (which is not a beautiful solution).
now i've tried your suggestion:
i added a field (with default value = 1) and set it to 0 when $static is too big. the thing is that it is now shown in my preview with the value 0, but i can't filter it for some reason.
maybe i have to take a deeper look into the views api and put it in a custom module. but views is very complex, so i was seeking a simpler solution, where Views Custom Field seemed to be perfect...
Comment #8
sgerbino commentedThis is my views solution, using Customfield PHP based on bfr's response.
It includes a javascript Are you sure message and automatically refreshes the page if the queries are executed