Last active
December 17, 2015 00:11
-
-
Save chrismccord/5519310 to your computer and use it in GitHub Desktop.
"I have a table that shows the 10 most recent entries and then via Sync new ones get added. Is there an easy way to remove existing entries to keep the total at 10?"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assuming your partial is named 'list_row' and your model is 'Todo' | |
class Sync.TodoListRow extends Sync.View | |
maxRows: 10 | |
afterInsert: -> | |
$rows = @$el.siblings("tr") | |
$rows.first().remove() if $rows.length > @maxRows | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment