开发者

Can jquery(.jeditable) be used to automatically drop down a select list?

I have a JSP page that builds a screen based on table data from my servlet. I'm using display tag to format the table data, and jquery.jeditable to make certain cells editable to th开发者_开发问答e user.

One of those cells is a select (drop-down) list of options. Right now, the select works, but in order to use it, it requires an excessive number of clicks and keystrokes:

1) click in the box to make it editable, 2) click the down arrow to see the list of options, 3) select an option, 4) hit "enter" to save the option I selected, 5) finally, hit tab, an arrow key, or something else to move out of the field.

I'd like to eliminate some of those steps, in particular 2 and 4. Here's what I'm looking for:

As soon as the cell is clicked [or if I simulate a click via jquery.trigger('click') ], the drop-down list displays, the user uses the arrow keys to select the option they want and 2) the user hits enter or tab to leave the field, saving the selected option. If esc is chosen instead of enter/tab, the cell reverts to its original value.

Before I spend hours trying to make this work, is there a jquery plugin that might do the job for me? I'd be so grateful for any pointers to a solution.


I'm trying to solve the same problem. As far as I can tell, there's no way to force a browser dropdown/select box to start in the 'expanded' state, nor is there a way to force one to expand via javascript... :P

The best solution I've come up with so far is to manually style the dropdown so that it LOOKS like it has been added with the jeditable edit-in-place plugin, while really it is just a regular dropdown. This gives us our one-click open functionality. Save on form submit (what I do), or on .change().

I know this is a sub-par solution, but I hope it helps! I'll update back here if I find something better.


I suppose a different solution would be to modify the jeditable plugin itself to use a jquery-based dropdown (which can open in 'expanded' form) instead of the built-in browser dropdown... Still not ideal, but it's an option!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜