Skip to content
Snippets Groups Projects
Commit ca80edee authored by Renaud Le Gac's avatar Renaud Le Gac
Browse files

Add the helper function encodeField and getTableName.

parent 2a8ab861
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,33 @@ App.dburl = '/' + App.name + '/plugin_dbui/database'; ...@@ -27,6 +27,33 @@ App.dburl = '/' + App.name + '/plugin_dbui/database';
* This constants is defined by the server. * This constants is defined by the server.
*/ */
/**
* Helper function mimicking the encode_field function running on the server
* (table, field) → TableField
* @param {Object} table
* @param {Object} field
*/
App.encodeField = function (table, field) {
var t, f;
t = table[0].toUpperCase() + table.slice(1, table.length);
f = field[0].toUpperCase() + field.slice(1, field.length);
return t + f;
}
/**
* Helper function returning the name of the database table
* associated to the store. works with store configured using the
* Dbui.getJsonStore method.
* @param {App.data.DirectStore} store
*/
App.getTableName = function (store) {
if ('baseParams' in store && 'tableName' in store.baseParams) {
return store.baseParams.tableName;
} else {
return undefined;
}
return store.baseParams.tableName;
}
/** /**
* Helper function to determine if a plugin is present * Helper function to determine if a plugin is present
* in the plugins list of a component * in the plugins list of a component
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment