Skip to content
This repository has been archived by the owner on Apr 2, 2019. It is now read-only.

Allow user to specify link display text by subclassing UriCell #88

Merged
merged 3 commits into from
Mar 27, 2013
Merged

Conversation

dandavison
Copy link

This PR replaces #81. See #41.

This PR allows users to control the display text of a link formatted by UriCell by overriding a function displayText. The existing solution is to write a custom cell class, which requires duplication of logic in the render method; with this PR the operation is more straightforward and does not duplicate any logic in the render method.

The PR includes one new test:

image

Dan Davison added 3 commits March 26, 2013 17:29
Currently a user needs to write a custom Cell class in order to format
URLs with an alternate display text. This requires implementing the
render method and thus duplicating logic in `UriCell`. This commit
allows display text to be specified by subclassing `UriCell` and
implementing a single function `displayText`. E.g. in coffeescript:

class MyUriCell extends Backgrid.UriCell
    displayText: -> @model.get('my_field_name')
The test function was originally created by copying the test function
for UriCell. This commit makes changes to the custom-display-link test
that were subsequently made to the vanilla UriCell test.
wyuenho added a commit that referenced this pull request Mar 27, 2013
Allow user to specify link display text by subclassing `UriCell`
@wyuenho wyuenho merged commit 840d973 into cloudflarearchive:master Mar 27, 2013
@dandavison dandavison mentioned this pull request Mar 27, 2013
dandavison pushed a commit that referenced this pull request Mar 28, 2013
These changes were mistakenly applied only to /lib/backgrid.js
wyuenho added a commit that referenced this pull request Mar 28, 2013
Apply #88 changes to src/cell.js
wyuenho added a commit that referenced this pull request Mar 29, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants