Results 1 to 3 of 3

Thread: How do I bind to singleton resource?

  1. #1

    Default How do I bind to singleton resource?

    Newbie evaluating ExtJS for a new project.

    Use case:

    * I am connecting to a RESTful API
    * The root of the API is a single resource with basic meta-data about the service and the logged in user (e.g. version no, user name etc.) as well as links to other resources.
    * The root resource is not a collection/set/whatever, therefore does not have an "id" nor is it indexed by an id


    ExtJS seems to assume that all model entities belong to collections. There does not seem to be any way to declare something as a singleton. In particular, in order to bind to this singleton resource via a view model, I had to pretend it did have an id. See example below, I used a link with a dummy id. Note: I was unable to use something innocuous like null or "".


    While this works, it seems a bit clumsy. Have I done it right? Is there a more elegant way to achieve the same thing?


  2. #2
    Touch Premium Member pkellner's Avatar
    Join Date
    Sep 2008
    San Jose, California


    I think you did it correctly, but I'm not sure of your concern. In your example, the binding of the singleton does not need any of the model stuff you have declared. The app would then be trivial, but still work

  3. #3

    Default concern is I need to pass a pretend id for my resource. its harmless, just a little ugly.could you elaborate though. which specific bits could I trim to get the same results?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts