Export to GitHub

flesler-plugins - issue #3

Quick options for "first" and "last" buttons


Posted on Feb 19, 2010 by Swift Elephant

There are easy options for connecting serialScroll to "prev" and "next" buttons. I think "first" and "last" buttons are just as handy.

I'm submitting a patch (basically 10 lines of trivial code) to implement this. Patch was made against trunk.

Thanks for the handy plugins!

Attachments

Comment #1

Posted on Feb 19, 2010 by Swift Elephant

Sorry, probably should have been "Enhancement".

Comment #2

Posted on Feb 19, 2010 by Swift Giraffe

Hi, you can achieve the same doing:

$('#first').click(function(){ $('#pane').trigger('goto', 0); });

And the same for last, it's not really saving you many bytes but adds it for everyone else who isn't using it. I also don't consider that such a common use case.

I appreciate your report though, thanks :)

Comment #3

Posted on Feb 20, 2010 by Swift Elephant

True, it's straight-forward to do that for the "#first" button.

However, having to specify the pane/target twice (in addition to the call to serialScroll) and having to declare how many items there are for the "#last" function is redundant, considering serialScroll already "knows about" and has easy access to both.

SYou could be more terse, at the expense of readability: {{{ $(settings.last||[]).bind(event, function(e){jump(e,items.length)}); //jump to last item }}}

Comment #4

Posted on Feb 20, 2010 by Swift Elephant

Or maybe the "move" function could handle special values like 'last'?

Comment #5

Posted on Feb 20, 2010 by Swift Giraffe

You can also know the amount of items right away from the outside with a simple selector:

$('#pane li').length

I insist that going to first and last is not that common and doesn't add new possibilities to the plugin, just saves a few bytes for a minority.

Status: WontFix

Labels:
Type-Enhancement Priority-Medium