1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- //
- // IBM Confidential
- // OCO Source Materials
- // BI and PM: Mobile
- // (C) Copyright IBM Corp. 2013
- // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- //
- dojo.provide('mobileAdmin.serverConfig.control.MobilePropertyGroup');
- // dojo dependencies
- // Mobile dependencies
- dojo.require('mobileAdmin.serverConfig.control.MobilePropertyGrid');
- dojo.require('mobileAdmin.serverConfig.control.MobilePropertyGridCell');
- dojo.declare('mobileAdmin.serverConfig.control.MobilePropertyGroup', null, {
- constructor: function(_this_Fragment, mobileMsgResources) {
- this.fragmentResources = _this_Fragment;
- this.msgResources = mobileMsgResources;
- },
- renderGroup: function(parentWidget, propertyGroup, dataModel) {
- var dataItems = dataModel.queryGroupProperties(propertyGroup);
- var dataGrid = this._buildDataGrid(dataModel, dataItems);
- var groupTitlePane = new dijit.TitlePane(
- {
- "class":'configPropertyGroup',
- title:eval(propertyGroup)
- }
- );
- groupTitlePane.set('content', dataGrid);
- parentWidget.domNode.appendChild(groupTitlePane.domNode);
- //a11y - set the id for the title bar node and the aria-labelledby attribute of the div with role="region"
- //a11y - remove the role="group" from the title pane dijit
- //mirrors dojo patch fix - https://bugs.dojotoolkit.org/attachment/ticket/15853/TitlePane_a11y_labelledby.patch
- var titleBarNodeId = groupTitlePane.domNode.id + '_titleBarNode';
- //check if this exists so I don't break IE5 rendering
- if(groupTitlePane.domNode.getElementsByClassName){
- groupTitlePane.domNode.getElementsByClassName('dijitTitlePaneTitle')[0].id = titleBarNodeId;
- document.getElementById(groupTitlePane.domNode.id + '_pane').setAttribute('aria-labelledby', titleBarNodeId);
- groupTitlePane.domNode.getElementsByClassName('dojoxGrid')[0].setAttribute('aria-labelledby', titleBarNodeId);
- }
- groupTitlePane.domNode.removeAttribute('role');
- dataGrid.startup();
- },
- _buildDataGrid: function(dataModel, dataItems) {
- var gridStructure =
- [
- {
- name: this.msgResources.ADM.SRV_CONF_PROPERTY_TITLE,
- field: 'propertyLabel',
- classes: 'clPropertyNameColumn',
- width: '70%',
- editable: false,
- formatter: function(item, rowIndex, cell) {
- var property = cell.grid.getItem(rowIndex);
- var spanString = '<span title="' + property.propertyName + '">' + eval(property.propertyLabel) + '</span>';
- return spanString;
- }
- },
- {
- name: this.msgResources.ADM.SRV_CONF_PROPERTY_VALUE,
- field: 'propertyValue',
- classes: 'clPropertyValueColumn',
- type: mobileAdmin.serverConfig.control.MobilePropertyGridCell,
- // widgetBuilder: null, // dojo.hitch(this, this.buildWidget),
- width: '30%',
- editable: true
- }
- ];
- var gridProperties = {
- items:dataItems,
- store:dataModel.dojoData,
- structure:gridStructure,
- noDataMessage:this.msgResources.ADM.SRV_CONF_GRID_NO_DATA_MESSAGE,
- loadingMessage:this.msgResources.ADM.SRV_CONF_GRID_LOADING_MESSAGE,
- autoHeight:true,
- width:'100%',
- singleClickEdit: true
- };
- var dataGrid = new mobileAdmin.serverConfig.control.MobilePropertyGrid(gridProperties, null);
- this.dataGrid = dataGrid;
- return this.dataGrid;
- },
-
- prepareForSave : function(){
- this.dataGrid.edit.apply();
- }
-
- });
|