API Docs for: 3.13.0
Show:

File: recordset/js/record.js

  1. /**
  2. * Provides a wrapper around a standard javascript object. Can be inserted into a Recordset instance.
  3. *
  4. * @class Record
  5. */
  6. var Record = Y.Base.create('record', Y.Base, [], {
  7. _setId: function() {
  8. return Y.guid();
  9. },
  10.  
  11. initializer: function() {
  12. },
  13.  
  14. destructor: function() {
  15. },
  16.  
  17. /**
  18. * Retrieve a particular (or all) values from the object
  19. *
  20. * @param field {string} (optional) The key to retrieve the value from. If not supplied, the entire object is returned.
  21. * @method getValue
  22. * @public
  23. */
  24. getValue: function(field) {
  25. if (field === undefined) {
  26. return this.get("data");
  27. }
  28. else {
  29. return this.get("data")[field];
  30. }
  31. return null;
  32. }
  33. },
  34. {
  35. ATTRS: {
  36.  
  37. /**
  38. * @description Unique ID of the record instance
  39. * @attribute id
  40. * @type string
  41. */
  42. id: {
  43. valueFn: "_setId"
  44. },
  45.  
  46. /**
  47. * @description The object stored within the record instance
  48. * @attribute data
  49. * @type object
  50. */
  51. data: {
  52. value: null
  53. }
  54. }
  55. });
  56.  
  57. Y.Record = Record;
  58.