## DataRecord The `DataRecord` class represents a single record within a data source. It extends the base `Model` class and provides additional methods and properties specific to data records. Each `DataRecord` is associated with a `DataSource` and can trigger events when its properties change. ### DataRecord API * [getPath][1] * [getPaths][2] * [set][3] ### Example of Usage ```js const record = new DataRecord({ id: 'record1', name: 'value1' }, { collection: dataRecords }); const path = record.getPath(); // e.g., 'SOURCE_ID.record1' record.set('name', 'newValue'); ``` ### Parameters * `props` **DataRecordProps** Properties to initialize the data record. * `opts` **[Object][4]** Options for initializing the data record. ## getPath Get the path of the record. The path is a string that represents the location of the record within the data source. Optionally, include a property name to create a more specific path. ### Parameters * `prop` **[String][5]?** Optional property name to include in the path. * `opts` **[Object][4]?** Options for path generation. * `opts.useIndex` **[Boolean][6]?** Whether to use the index of the record in the path. ### Examples ```javascript const pathRecord = record.getPath(); // e.g., 'SOURCE_ID.record1' const pathRecord2 = record.getPath('myProp'); // e.g., 'SOURCE_ID.record1.myProp' ``` Returns **[String][5]** The path of the record. ## getPaths Get both ID-based and index-based paths of the record. Returns an array containing the paths using both ID and index. ### Parameters * `prop` **[String][5]?** Optional property name to include in the paths. ### Examples ```javascript const paths = record.getPaths(); // e.g., ['SOURCE_ID.record1', 'SOURCE_ID.0'] ``` Returns **[Array][7]<[String][5]>** An array of paths. ## triggerChange Trigger a change event for the record. Optionally, include a property name to trigger a change event for a specific property. ### Parameters * `prop` **[String][5]?** Optional property name to trigger a change event for a specific property. ## set Set a property on the record, optionally using transformers. If transformers are defined for the record, they will be applied to the value before setting it. ### Parameters * `attributeName` **([String][5] | [Object][4])** The name of the attribute to set, or an object of key-value pairs. * `value` **any?** The value to set for the attribute. * `options` **[Object][4]?** Options to apply when setting the attribute. * `options.avoidTransformers` **[Boolean][6]?** If true, transformers will not be applied. ### Examples ```javascript record.set('name', 'newValue'); // Sets 'name' property to 'newValue' ``` Returns **[DataRecord][8]** The instance of the DataRecord. [1]: #getpath [2]: #getpaths [3]: #set [4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean [7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array [8]: #datarecord