DRUPAL: customize dropdown Views filter - drupal

I'm using Views dropdown filter (with tags) and it works great. However I would like to customize it in this way:
1 - remove button "Apply" and automatically update Views (at the moment I'm updating it with Ajax)
2- allow my customer to change the order of the dropdown items (specifying top items)
3- select multiple items without having to press the SHIFT button on keyboard (do not unselect other items if new items are selected)
http://dl.dropbox.com/u/72686/viewsFilter1.png
Let's suppose the items in the image are tags... something like this:
http://dl.dropbox.com/u/72686/viewsFilter2.png
thanks

Use jQuery to .hide() the Apply button, and then set a handler on the filter fields so that whenever one of them is changed (i.e., by the user), the Apply button registers a click.
Hmm, can't help with this one. You might be stuck writing a custom module that hooks into the Views API.
Sounds like the Sexy Exposed module would solve this problem?

I'm using the following code to keep the items selected and it works.
$('#edit-tid option').click(function() {
$(this).toggleClass("selected");
$("option:not(.selected)").removeAttr("selected");
$("option.selected").attr("selected", "selected");
//submit request
$('#edit-submit-Portfolio').click();
});
When a request is submitted the page is refreshed. The selected items are still selected (class="selected") but the javascript code do not keep them selected.. I don't understand why, since they have the correct class attribute.
So.. it doesn't work after refresh, even if the html code is the same (the same class="selected" attribute is assigned to the same items).
thanks

I've solved point 1 and 2, installing better exposed filter module from drupal website.

Related

Are Meteor template events lost if the template is relocated within the DOM?

I have two lists that appear adjacent to each other on my page. List items can be dragged from one list into the other, and vice-versa (using jquery.sortable). The list item is a template, within which is a button. The click event for the button is defined using the Template.my-button.events method.
When the page is rendered, if I click this button in a list item, the events fire ok. If, however, I drag this list item into the adjacent list, the events no longer fire.
Does anyone know why this is and/or can suggest a way to circumvent this issue?
It is possible jquery.sortable messes with Meteor events tracker. Maybe not the most elegant way but a possible work-around would be to add an eventListener through classic JS in your Template.page.onRendered().
Something like:
Template.yourPage.onRendered(function() {
document.getElementById("yourButtonId").addEventListener("click", function() {
#your code
});
})

Using Jquery to create a drag and drop select box or text box? (not lists)

I've worked thru the various jquery UI demos of drag and drop and sortable. These show how to get items from one list to another. One example even shows a shopping cart demo.
Am I missing something in that a item won't be part of a post to the server right? so what use is this other than reorganizing a display on a page?
Is it possible to adapt this to some sort of input field?
TIA
J
item won't be part of a post to the server right? so what use is this
other than reorganizing a display on a page?
Allowing users to reorganize the elements in the page is a nice feature, even if you aren't notified on the server. For example, by allowing users to drag and drop elements, you may store his current page layout in localStorage so that the next time the user visits your page, the layout is restored automatically. You don't need to be notified on the server side what the user preferences are.
All of these jQuery plugins (sortable, draggable, etc.) have functions that you can hook into and trigger some server side processing as well. For example, when a user drags and drops an element from one section of the screen to another, you can perfectly make an ajax request and do some processing on your end. This would provide a very nice user experience to the user.
For example:
$( ".selector" ).droppable({
drop: function( event, ui ) {
$.post('http://server/somection',data{...});//do something on the server-side
};
});
Absolutely! jsfiddle with demo here.

How can I add radio button and submit button in a drupal view?

I want to add radio button in my drupal view ?
I need to make a table of users and set for each of them one status(present,absent,delayed,...) by use of radio buttons, and A button under the table to save these statuses.
So how can I change view?
Mohsen,
Maybe Views Bulk Operations module can help you. You can download it at http://drupal.org/project/views_bulk_operations.
I used embed form module to add some radio buttons in my view. and now I must implement submission.
I wish I new.
I'm currently playing with hook_views_data to create a relationship within Views between my table and a node. This works ok.
I just need to work out how to make this data submittable from within the View.
If I work it out I'll let you know.

DRUPAL, Views: exposed filter.. how can I unselect all tags?

I'm using Drupal, Views, tag exposed filter and I would like to allow my customer to select the default tags from back-end. However when he selects some tags is not possible anymore to unselect all of them.
See initial picture: http://dl.dropbox.com/u/72686/Picture%201.png
Now all the tags are unselected, but if I select just one of them, then I cannot anymore come back to the initial configuration. (at least one tag remains selected).
How can I fix this ?
thanks
If you set the Default view, and someone overrides child views, it no longer uses the default settings. However, if they don't click on 'Override' when changing a view setting type, it will apply those changes to that view and the default view.
You have to setup the views, and he makes the choice what tags to select. It sounds like you two are overwriting each other in the view filter options. When you create a child view and change its configuration, be sure to click 'Override' in the top right corner of the option that appears. This will let you override that views settings, and not alter the initial default settings.
Also, you probably know this, but if you ctrl click it should unselect one that is selected.

Is it possible to catch a comboBoxes value before change with a change event

I am displaying a combo box in something of a WYSIWYG preview. I want the user to be able to click on the combo box and see the options inside, but I don't want them to be able to change the value. I tried using preventDefault() on the change event but it doesn't work. I don't want to disable it because I do want the user to be able to "look inside" the dropdown.
So I'm trying to block the change, but can't. My next resort is to change the selected index back to what it was before the change, Is there any way to do this within the scope of a ListEvent.CHANGE event listener?
Current Workaround is to basically re-assign the controls selected item the same way I am defining the selected item when I originally build it (a default selection). So a user sees their change then it immediately changes back to the default selection.
Are you sure that a combobox is what you want? could you do the same thing with a list component that is not selectable?
update:
If you must use a combobox and you dont want the lag from listening for the event and resetting the control, I see two possible options. You could subclass the control and make your own. When you do, hijack any methods that set the value besides the initial selection.
Or, you could try something like this: http://wmcai.blog.163.com/blog/static/4802420088945053961/. The site seems like it is in another language but the code is still there. It will allow you to make your options disabled, so the user cannot choose one of the other options.
HTH

Resources