PDA

View Full Version : Accessing record data from an external mousedown event.



14 Jan 2014, 2:53 PM
Hello,

I have a grid which includes a combobox. The first time a value from the combobox is selected I need to store that value so that I can repopulate the combobox later. Later when a user clicks on a checkbox from the same row I need to get access to the original value that was stored for that row. Essentially I want to add an 'originalValue' record to the record, which I can later access from the checkboxes onMouseDown event. I am using Ext 3.4. What is the best way to set and access this data?

Thanks for any help you can provide



Ext.grid.CheckColumn.prototype = {...
onMouseDown : function(e, t) {
// Determine if this is a checkbox click
if (t.className
&& t.className.indexOf('x-grid3-cc-' + this.id) != -1) {
// Manually set the value of the checkbox
e.stopEvent();
var rowIndex = this.grid.getView().findRowIndex(t);
var record = this.grid.store.getAt(rowIndex);
if (this.dataIndex == "reconfirmTrade")
console.log(record.get('originalValue')); //comes back undefined
record.set(this.dataIndex, !record.data[this.dataIndex]);
...
}

//on combobox i set the record when the item is selected.

'select' : function(combo, record, index) {
if (this.originalValue == null || this.originalValue == '')
{
record.set('originalValue', this.startValue);
}

mitchellsimoens
15 Jan 2014, 7:32 AM
The record should keep track of any modifications. Have you inspected the record object itself?

15 Jan 2014, 11:58 AM
Hi Mitchell,

Thanks for your response. I did find a 'modified' member on record object which I was able to use.