{ "id": "97494", "key": "ALOY-104", "fields": { "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "14633", "description": "Alloy 0.3.3", "name": "Alloy 0.3.3", "archived": false, "released": true, "releaseDate": "2012-11-30" }, { "id": "14600", "description": "2012 Sprint 23", "name": "2012 Sprint 23", "archived": true, "released": true, "releaseDate": "2012-11-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-11-15T20:36:50.000+0000", "created": "2012-07-17T11:56:02.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "GA-candidate", "notable" ], "versions": [], "issuelinks": [ { "id": "22711", "type": { "id": "10020", "name": "Depends", "inward": "is dependent of", "outward": "depends on" }, "inwardIssue": { "id": "104320", "key": "ALOY-360", "fields": { "summary": "Model-View binding", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "6", "description": "gh.issue.epic.desc", "name": "Epic", "subtask": false } } } } ], "assignee": null, "updated": "2018-03-07T22:26:04.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "12329", "name": "Runtime", "description": "Generic bucket for uncategorized runtime issues" }, { "id": "12326", "name": "XML", "description": "View XML and parsing" } ], "description": "h4. view prototype\r\n{code:xml}\r\n\r\n\r\n\r\n \r\n\r\n{code}\r\n\r\nh4. controller prototype\r\n{code:javascript}\r\n// \"model\" refers to the current model being rendered from the collection. This transformation\r\n// function should return a Javascript object containing properties that you want to \r\n// modify and use in the binding. So for example, if we wanted to wrap the title from the model\r\n// in square brackets we could do the following:\r\nfunction transformProperties(model) {\r\n // Get the JSON object representing the current model's attributes\r\n var transform = model.toJSON();\r\n\r\n // Make the aforementioned modification\r\n transform.title = '[' + transform.title + ']';\r\n \r\n // return the transformations, no changes will actually be made to the model\r\n return transform;\r\n}\r\n\r\n// \"collection\" is the collection being used as the data source for the tableview. From this\r\n// function we can return an array that is either the full set of models from the collection,\r\n// or a filtered subset. The returned\r\nfunction filterCollection(collection) {\r\n return someConditionalFunction() ? \r\n // return the full set of models from the collection\r\n collection.models :\r\n\r\n // render only models with \"someString\" in the title\r\n collection.where({ title: title.indexOf('someString') !== -1 }); \r\n}\r\n{code}\r\n\r\n* - *dataCollection* will refer to an instance of a collection containing models that you would like to be iterated over in the associated view, in this case a TableView\r\n* - *dataTransform* will refer to a function defined in the associated controller that will allow you to modify each model before rendering it in the \"repeater\". This will most commonly be for transformation and normalization of data.\r\n* - *dataFilter* will refer to a function defined in the associated controller that will allow the developer to filter down the list of models from the collection that should be rendered as rows. \r\n* - Both *dataTransform* and *dataFilter* are optional.\r\n* - Bound properties from the models can be accessed using the *\\{\\}* notation, where the property refers to a property on the model.\r\n* - The TableView should be able to render inline rows, as well as rows as well.\r\n* - When bindings are used in a separate controller, like if your TableViewRow definition is in its own controller, the current model can be references with the *$model* variable in the controller code.\r\n", "attachment": [], "flagged": false, "summary": "Enable Model-View binding on TableViews", "creator": { "name": "rmcmahon", "key": "rmcmahon", "displayName": "Russell McMahon", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "rmcmahon", "key": "rmcmahon", "displayName": "Russell McMahon", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [], "maxResults": 0, "total": 0, "startAt": 0 } } }