{I" class:ETI"ProcessedAsset;FI"logical_path;TI"#netzke/testing/helpers/grid.js;FI" pathname;TI"i/Users/mxgrn/code/netzke/netzke-testing/app/assets/javascripts/netzke/testing/helpers/grid.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+™˙¸RI" length;TiI" digest;TI"%ba9bb5d7f27339d696d15aa7ee9ecdaf;FI" source;TI"(function() { Ext.apply(window, { grid: function(title) { if (title) { return Ext.ComponentQuery.query('grid[title="' + title + '"]')[0]; } else { return Ext.ComponentQuery.query('grid{isVisible(true)}')[0]; } }, expandRowCombo: function(field, params) { var column, editor, g; g = g || this.grid(); editor = g.getPlugin('celleditor'); column = g.headerCt.items.findIndex('name', field) - 1; window.editor = editor; editor.startEditByPosition({ row: g.getSelectionModel().getCurrentPosition().row, column: column }); return editor.activeEditor.field.onTriggerClick(); }, addRecords: function() { var params, record, _i, _len; params = arguments[arguments.length - 1]; for (_i = 0, _len = arguments.length; _i < _len; _i++) { record = arguments[_i]; if (record !== params) { record = params.to.getStore().add(record)[0]; record.isNew = true; } } if (params.submit) { return click(button('Apply')); } }, addRecord: function(recordData, params) { var grid, record; params = params || []; grid = params.to || this.grid(); record = grid.getStore().add(recordData); return grid.getSelectionModel().select(grid.getStore().last()); }, updateRecord: function(recordData, params) { var grid, key, record, value, _results; params = params || []; grid = params.to || this.grid(); record = grid.getSelectionModel().getSelection()[0]; _results = []; for (key in recordData) { value = recordData[key]; _results.push(record.set(key, value)); } return _results; }, selectAssociation: function(attr, value, callback) { expandRowCombo(attr); return wait(function() { select(value, { "in": combobox(attr) }); return callback.call(); }); }, valuesInColumn: function(name, params) { var grid, out; if (params == null) { params = {}; } grid = params["in"] || this.grid(); out = []; grid.getStore().each(function(r) { var assocValue; assocValue = r.get('meta').associationValues[name]; return out.push(assocValue ? assocValue : r.get(name)); }); return out; }, selectAllRows: function(params) { var grid; if (params == null) { params = {}; } grid = params["in"] || this.grid(); return grid.getSelectionModel().selectAll(); }, rowDisplayValues: function(params) { var grid, i, record, visibleColumns; if (params == null) { params = {}; } grid = params["in"] || this.grid(); record = params.of || grid.getSelectionModel().getSelection()[0]; visibleColumns = []; Ext.each(grid.columns, function(c) { if (c.isVisible()) { return visibleColumns.push(c); } }); i = -1; return Ext.Array.map(Ext.DomQuery.select('tr[data-recordid="' + record.internalId + '"] td div'), function(cell) { i++; if (visibleColumns[i].attrType === 'boolean') { return record.get(visibleColumns[i].name); } else { return cell.innerHTML; } }); }, selectLastRow: function(params) { var grid; if (params == null) { params = {}; } grid = params["in"] || this.grid(); return grid.getSelectionModel().select(grid.getStore().last()); }, selectFirstRow: function(params) { var grid; if (params == null) { params = {}; } grid = params["in"] || this.grid(); return grid.getSelectionModel().select(grid.getStore().first()); }, editLastRow: function() { var data, grid, key, record, store, _results; data = arguments[0]; grid = Ext.ComponentQuery.query("grid")[0]; store = grid.getStore(); record = store.last(); _results = []; for (key in data) { _results.push(record.set(key, data[key])); } return _results; }, completeEditing: function(g) { var e; g = g || this.grid(); e = g.getPlugin('celleditor'); return e.completeEdit(); } }); }).call(this); ;TI"dependency_digest;TI"%73b65d8f871e04a4745ca71e7222d736;FI"required_paths;T[I"i/Users/mxgrn/code/netzke/netzke-testing/app/assets/javascripts/netzke/testing/helpers/grid.js.coffee;FI"dependency_paths;T[{I" path;TI"i/Users/mxgrn/code/netzke/netzke-testing/app/assets/javascripts/netzke/testing/helpers/grid.js.coffee;F@I"2013-11-23T08:06:33+07:00;T@I"%bcb2a62d4c443960714100caf380cf08;FI" _version;TI"%4bf7b15359fe8e0974f7f263e26e27f4;F