Skip to content
Snippets Groups Projects
Commit 462d07eb authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Show the property defintion using tool tip.

parent a629dec1
No related branches found
No related tags found
2 merge requests!6Master,!57 preferences
......@@ -16,6 +16,14 @@ Ext.define('App.grid.property.Preferences', {
*/
dbtable: "preferences",
/**
* @cfg {String} fieldDefiniton
* The database field containing the property definition.
* It is used in the tool tip associated to each property.
*
*/
fieldDefinition: "definition",
/**
* @cfg {String} fieldProperty
* The database field containing the property names
......@@ -70,6 +78,7 @@ Ext.define('App.grid.property.Preferences', {
me.refStore = App.getStore(me.dbtable + "Store");
// the names of the property and value fields in the store
me.fieldDefinition = App.encodeField(me.dbtable, me.fieldDefinition);
me.fieldProperty = App.encodeField(me.dbtable, me.fieldProperty);
me.fieldValue = App.encodeField(me.dbtable, me.fieldValue);
......@@ -95,9 +104,15 @@ Ext.define('App.grid.property.Preferences', {
data = {};
records.forEach(function (record) {
var property, value;
var definition, property, value;
definition = record.get(me.fieldDefinition);
property = record.get(me.fieldProperty);
value = record.get(me.fieldValue);
// property includes its definition as a tool tip
property = "<div data-qtip='" + definition + "'>" + property + "</div>";
data[property] = value;
});
......@@ -123,14 +138,19 @@ Ext.define('App.grid.property.Preferences', {
"use strict";
var me = this,
data = me.getSource(),
properties = Object.keys(data);
properties = Object.keys(data),
rex = new RegExp(">(.+)<");
// find the record associate to each property
// update it if necessarily
properties.forEach(function (property) {
var newValue, oldValue, record;
record = me.refStore.findRecord(me.fieldProperty, property);
var newValue, oldValue, record, value;
// property includes its definition as a tool tip
// extract the property value
value = rex.exec(property)[1];
record = me.refStore.findRecord(me.fieldProperty, value);
newValue = data[property];
oldValue = record.get(me.fieldValue);
......
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