new FileBasedStoreLoader(config)
Arguments:
-
config
(Object)
Properties
-
entity
(TubEntity)
-
foldersConfig
(Array:.<{path:: string:}>)
 Array of folder configuration to scan for files. Necessary param is path - path to folder. You can also pass additional information for use inonBeforeRowAdd
andonNewFolder
callbacks. Currently processed root folder accessible from FileBasedStoreLoader.processingRootFolder -
zipToArray
(Boolean)
 Transform result from array of object to array-of-array representation. Default true -
uniqueID
(Boolean)
 Result data must contain ID attribute and values must be unique. Default true. -
[fileMask]
(RegExp)
 Regular expression to filter folder files. Each fileName (without path) will be tested by this regExp -
[attributeRegExpString]
(String)
 String representation of regular expression to found attribute and it value in input content. Default is '^\/\/@(\w+)\s"(.*?)"' what mean find all string like: //@attribute "value" You can pass empty string to disable attribute parsing by regExp and do it manually inonBeforeRowAdd
handler. -
[onBeforeRowAdd]
(function)
 Callback called for each row BEFORE it added to store. In case it return false row not added. Called with args (this: FileBasedStoreLoader, fullFilePath: string, fileContent: string, oneRow: Object); -
[onNewFolder]
(function)
 Callback called for each new folder in case of recursive folder. In case callback return false or not defined - folder not processed. Called with args (this: FileBasedStoreLoader, fullFolderPath: string, recursionLevel: integer);
-
Example
var loader = new FileBasedStoreLoader({
entity: me.entity,
foldersConfig: folders,
fileMask: /-fm\.def$/,
onBeforeRowAdd: postProcessing
});
resultDataCache = loader.load();
Members
config: Object
Configuration
attributes: Array:.<Object:>
readonly
Entity attributes array
haveModifyDate: Boolean
readonly
Is mStore.simpleAudit
enabled for current entity (exist mi_modifyDate
attribute)
haveCreateDate: Boolean
readonly
Is mStore.simpleAudit
enabled for current entity (exist mi_createDate
attribute)
processingRootFolder: *
readonly
Currently processed root folder
resultCollection: Array:.<Object:>
protected
Array of Object representing dirty result
Methods
load() → TubCachedData
Perform actual loading.
mStore.simpleAudit
enabled for current entity (exist mi_modifyDate
attribute)
mStore.simpleAudit
enabled for current entity (exist mi_createDate
attribute)
load() → TubCachedData
Perform actual loading.