I'm trying to populate a grid based off rows checked in another grid, but adding rows is proving somewhat tricky.
Grid code:
Adding to said grid:
I've also tried putting the records in an array first and then using add.
The first problem is that only the first cell gets a value, the rest are empty. The second problem is that the combobox doesn't show up. When I click on a combobox cell, it gives the error:
The third problem is while the first row will get added, any additional ones give the error:
Looking again, I also see that the initial row filled with -'s has only the first cell filled in as well.
Grid code:
this.myData = [['-','-','-','-','-','-','-','-','-']]; this.ds = new Ext.data.Store({ proxy:new Ext.data.MemoryProxy(this.myData), reader:new Ext.data.ArrayReader({id:0}, [ {name:"part"}, {name:"desc"}, {name:"weight"}, {name:"failureMode"}, {name:"timeToFailure"}, {name:"carton"}, {name:"transnum"}, {name:"returnReason"}, {name:"note"} ]) }); this.ds.load(); var myColumns = [ {header: "Part #",width:50,sortable:true}, {header: "Description",width: 150,sortable: true}, {header: "Weight",width: 70, sortable: true}, {header: "Failure Mode",width: hideMode ? 0 : 60, editor: new Ext.form.ComboBox({transform:'failuremode',lazyRender:true,triggerAction:'all'}), sortable: true}, {header: "Time to Failure", width: hideTime ? 0 : 90, editor: new Ext.form.ComboBox({transform:'timetofailure',lazyRender:true,triggerAction:'all'}), sortable: true}, {header: "In Carton #", width: 230, editor: new Ext.form.ComboBox({transform:'cartonnum',lazyRender:true,triggerAction:'all'}), sortable: true}, {header: "RMA #", width: 230, sortable: true}, {header: "Return Reason", width: hideReason ? 0 : 90, editor: new Ext.form.ComboBox({transform:'returnreason',lazyRender:true,triggerAction:'all'}), sortable: true}, {header: "Note",width:60,sortable:false,editor: new Ext.form.TextField()} ]; this.cm = new Ext.grid.DefaultColumnModel(myColumns); this.grid = new Ext.grid.EditorGrid('partcartongrid',{selModel: new Ext.grid.RowSelectionModel({singleSelect:true}),ds: this.ds, cm: this.cm}); this.grid.render();
var record = null; var values = {}; for (i = 0; i < quantity; i++) { values = {}; values['part'] = partnum; values['desc'] = name; values['weight'] = weight; values['failureMode'] = 'Constant'; values['timeToFailure'] = 'Expected Life'; values['carton'] = insertCarton; values['transnum'] = rmanum; values['returnReason'] = 'Excess Inventory'; values['note'] = ''; record = new Ext.data.Record(values,0); this.ds.add(record); }
The first problem is that only the first cell gets a value, the rest are empty. The second problem is that the combobox doesn't show up. When I click on a combobox cell, it gives the error:
Quote:
uncaught exception: Event does not exist: "complete". Line 0 |
Quote:
r has no properties https://demo.xteconline.com/system/j...id/GridView.js Line 746 |

#2
![]() |
![]() Damn, figured out why only my first cell was populated. I needed to add the dataIndex param to my columnmodel (which didn't change much so I overlooked that part). Still getting the same error trying to add another row after the first one (r has no properties).
Edit: Also still having trouble with the comboboxes. HTML for the ones being transformed: <select id="failuremode" style="display:none"> <option value="Constant">Constant</option> <option value="Intermittent">Intermittent</option> </select> <select id="timetofailure" style="display:none"> <option value="Expected Life">Expected Life</option> <option value="Early Failure">Early Failure</option> <option value="Failed On Install">Failed on Install</option> </select> <select id="cartonnum" style="display:none"> <option value="Not Shipping">Not shipping</option> </select> <select id="returnreason" style="display:none"> <option value="Excess Inventory">Excess Inventory</option> <option value="Rec'd Incorrect Part">Rec'd Incorrect Part</option> <option value="Ordered Incorrect Part">Ordered Incorrect Part</option> </select> ![]() |
#3
![]() |
![]() Edit: For some reason I read it wrong in the constructor that if you pass 0 in, it will generate an ID. But it doesn't, so it was halting due to the fact that two records had the same ID (although I thought I had tried it before without a second parameter and it didn't work). That fixes my problem with adding additional rows.
Still the same problem with my comboboxes. I don't know where that error is coming from. It's basically a copy of the editor grid example with nearly the same parameters to the comboboxes (except for typeAhead). ![]() |
#4
![]() |
![]() You forgot to wrap the field (the combo) in a GridEditor. Take a look at the editor grid example to see what I mean.
![]() |
#5
![]() | |
![]() Quote:
Seems typing out my thoughts really help though, I seem to find my mistakes faster when I do that....too bad I did them on here though where I look foolish :lol: ![]() |