Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !5295

Getter/setter methods for object data-source

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/ioleo/patch-1 into master Sep 26, 2012
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: ioleo

BC break: no Feature: yes Documentation: in PR description

Setter method allows to customize what is set as data-value.

Previously the script would break if item was an object, becouse render method rendered <li data-value="[object Object]">.

This method allows you to specify which field should be used as identifier for your result (preferabely database entry ID, but it can be any unique field).

Getter method allows to customize how item is retrieved from data source.

Previously the script just passed item (which was sufficient for simple string).

This method is connected to setter method. If you set data-value as item.id then the getter method must look for item.id == pk (where pk is value of data-value passed to this function). Returns the object matching that identiefier.

Example on JSFiddle:

http://jsfiddle.net/ZAQ2S/12/

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/ioleo/patch-1