Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
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?
i 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.
Well, 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.
because 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...
This 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
print "<form method='post'>";
print "<input name='".$data->time_track_ttid."' class='form-submit' type='submit' value='Remove entry' onclick=\"return confirm('Are you sure you want to remove this entry?');\" />";
print "</form>";
$a=$_POST[$data->time_track_ttid];
if (!empty($a)) {
db_query("DELETE FROM {time_track} WHERE ttid = %d", $data->time_track_ttid);
header("Location: #");
}
if(isset($_POST['submit'])) {
unset($_POST['submit']);
}
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