-
13 Dec 2012 2:20 AM #11
on add button click radio value is not clearing
on add button click radio value is not clearing
Hi ,
I am using extjs 4 and using rowEditor inside a row there is an radio groups , on add button am setting default value to the radio groups as 'null', it will come fine while saving ill select one value, after that once again if i click on add row , the radio group is taking previous value here is the code.
thanks in advance for your helpCode:grid = Ext.create('Ext.grid.Panel', { renderTo: Ext.Element.get('testDiv'), plugins: [rowEditing], store: userStore, width: 960, height:250, frame: true, selModel: Ext.create('Ext.selection.CheckboxModel'), title: 'Meeting Clients', columns: [{ text: 'ID', width: 40, sortable: true, dataIndex: 'id', hidden:true },{ text: 'First Name', flex: 1, sortable: true, //renderer: renderTopic, dataIndex: 'firstName', field: { xtype: 'textfield', allowBlank: false } }, { text: 'Last Name', flex: 1, sortable: true, dataIndex: 'lastName', field: { xtype: 'textfield', allowBlank: false } }, { text: 'Company Name', flex: 1, sortable: true, dataIndex: 'companyName', field: { xtype: 'textfield', allowBlank: false } }, { text: 'Country', flex: 1, sortable: true, dataIndex: 'country', field: { xtype: 'textfield', allowBlank: false }, renderer: function (value, meta, record) { var max = 42; meta.tdAttr = 'data-qtip="' + value + '"'; return value.length < max ? value : value.substring(0, max - 3) + '...'; } }, { //xtype: 'radiogroup', flex: 1, sortable: true, //tooltip: 'C Name Some name test', text: "<span ' title='#{meetingManager.antiBriberyPlolicy()}'>Gov\'t Official ? <img src=\"#{request.contextPath}/images/help2.jpg \" height=\"18\" width=\"18\"/></span>", //xtype: 'fieldcontainer', id: 'govtOff', defaultType: 'radiofield', renderer: renderStatus, dataIndex: 'govtOfficial', field: { xtype: 'radiogroup', allowBlank: false, cls: 'x-check-group-alt', items: [ {boxLabel: 'Yes', name: 'govtOfficial', inputValue: true, checked:false}, {boxLabel: 'No', name: 'govtOfficial', inputValue: false, checked:false} ], setValue: function (value) { if (!Ext.isObject(value)) { var obj = new Object(); obj[this.name] = value; value = obj; } Ext.form.RadioGroup.prototype.setValue.call(this, value); } } },{ xtype: 'actioncolumn', width:60, sortable: false, items: [{ icon:'#{request.contextPath}/images/trash-btn-2011.png', tooltip: 'Delete Meeting Clients', dataIndex: 'id', handler: function(grid, rowIndex, colIndex) { Ext.MessageBox.confirm('', "Would you like to delete this Client?", function (btn) { if (btn == 'yes') userStore.removeAt(rowIndex); }); } }] } ] , dockedItems: [{ xtype: 'pagingtoolbar', store: userStore, layout: 'hbox', // same store GridPanel is using dock:'bottom', align:'center', hideRefresh: true, displayInfo: true, listeners: { 'afterrender': function (component) { component.down('#refresh').hide() },single: true }, displayMsg: 'Clients {0} - {1} of {2}', prependButtons: true, items: [ { xtype: 'label', width:300 } ], otherItems: [ { xtype: 'combo', itemId: 'combotop', id:'combotop', autoSelect:true, readOnly:false, allowblank:false, width:50, disabled: true, queryMode: 'local', store: new Ext.data.ArrayStore({ id: 0, fields: [ 'myId', // numeric value is the key 'displayText' ], data: [[50, '50'], [100, '100'],[150, '150'], [200, '200']] // data is local }), listeners: { 'afterrender': function(combo) { var recordSelected = combo.getStore().getAt(0); combo.setValue(recordSelected.get('myId')); }, 'select': function (combo, records, eOpts) { Ext.getCmp('combobottom').setValue(combo.getValue()); grid.store.pageSize = combo.getValue(); userStore.loadPage(1); } }, valueField: 'myId', displayField: 'displayText', triggerAction: 'all' } ], emptyMsg: "No Clients to display" }, { xtype: 'pagingtoolbar', store: userStore, // same store GridPanel is using dock: 'top', align:'center', hideRefresh: true, displayInfo: true, listeners: { 'afterrender': function (component) { component.down('#refresh').hide() },single: true }, displayMsg: 'Clients {0} - {1} of {2}', prependButtons: true, items: [ { xtype: 'label', width:300 } ], otherItems: [ { xtype: 'combo', itemId: 'combobottom', id:'combobottom', autoSelect:true, readOnly:false, allowblank:false, width:50, disabled: true, queryMode: 'local', store: new Ext.data.ArrayStore({ id: 0, fields: [ 'myId', // numeric value is the key 'displayText' ], data: [[50, '50'], [100, '100'],[150, '150'], [200, '200']] // data is local }), listeners: { 'afterrender': function(combo) { var recordSelected = combo.getStore().getAt(0); combo.setValue(recordSelected.get('myId')); }, 'select': function (combo, records, eOpts) { Ext.getCmp('combotop').setValue(combo.getValue()); grid.store.pageSize = combo.getValue(); userStore.loadPage(1); } }, valueField: 'myId', displayField: 'displayText', triggerAction: 'all' } ], emptyMsg: "No Clients to display" },{ xtype: 'toolbar', dock: 'top', align:'center', items: [{ text: 'Add Client', iconCls: 'icon-add2', minWidth : 100, pressed: true, handler: function(){ // empty record // edit = this.editing; //edit.cancelEdit(); rowEditing.cancelEdit(); var r = Ext.ModelManager.create({ firstName: '', lastName:'', companyName:'', country:'', govtOfficial:null }, 'MeetingClients'); Ext.getCmp("govtOff").reset; userStore.insert(0, r); rowEditing.startEdit(0, 0); } },{ iconCls: 'icon-trash3', pressed: true, handler: function(){ selections = grid.getSelectionModel().getSelection(); var delArray=''; if(selections.length === 0){ alert('Atleast select one record to delete'); } else if (selections) { Ext.MessageBox.confirm('', 'Would you like to delete '+ selections.length +' Clients?', function(btn) { if (btn == 'yes'){ //selected=grid.getSelectionModel().getSelection(); Ext.each(selections, function (item) { //delArray.push(item.data.meetingClientId); delArray = delArray +','+item.data.meetingClientId; }); deleteSelected(delArray); } }); } } }] //items end }, ] //docked items end })//Grid End
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote