में ग्रिड पंक्ति को हाइलाइट करना/चुनना मैं एक्सएस जेएस के लिए नौसिखिया हूं। मैं एक ग्रिड पैनल पर काम कर रहा हूं जिसमें जब मैं किसी भी पंक्ति का चयन/क्लिक करता हूं, तो चयनित पंक्ति से संबंधित कुछ डेटा ग्रिड के नीचे पैनल में प्रदर्शित होता है। साथ ही जब विंडो लोड हो जाती है तो पहले डिफ़ॉल्ट रूप से चयनित/हाइलाइट किया जाना चाहिए। वर्तमान में ग्रिड & पैनल ठीक से प्रदर्शित होता है। यहां तक कि चयनित पंक्ति से संबंधित डेटा पैनल में प्रदर्शित होता है लेकिन पंक्ति को हाइलाइट नहीं किया जा रहा है। मैंने grid.focusRow(0)
& grid.getRow(0).highlight()
विधियों का प्रयास किया है लेकिन वे काम नहीं कर रहे हैं। नीचे मेरा कोड है।ExtJS
//the js file code
initComponent : function() { //within the window instance
var single = false;
var store = new Ext.data.XmlStore({//all necessary fields added}); //store
HttpUtil.syncCall(this.url, "GET", this.loadStore, store,this);
var acctTplMarkup = [//the fields here are displayed on row selection ];
/*The template for displaying the details of the selected row */
this.acctTpl = new Ext.Template(acctTplMarkup);
//check for request type, if type is range of checks create the grid
if (single == false) {
var gridView = new Ext.grid.GridView();
var colModel = new Ext.grid.ColumnModel([ {
header : 'Status',
dataIndex : 'status'
}, {
header : 'Message',
dataIndex : 'message'
} ]);
var selModel = new Ext.grid.RowSelectionModel({
singleSelect : true
});
grid = new Ext.grid.GridPanel({
...
listeners : {
render : function(grid) {
Ext.getCmp('check').store.on('load',function(store, records, options) { //check is the id value for the window instance
grid.getSelectionModel().selectFirstRow();
});
}
}
}); //gridPanel
} //if
/* If request type is range select then display the grid */
...
if (single == false) {
grid.getSelectionModel().on('rowselect', function(sm, rowIdx, r) {
Ext.getCmp('check').acctTpl.overwrite(Ext.getCmp('detailPanel').body, r.data);
}); //rowselect
} //if
Ext.apply(this, {
...
listeners : {
'afterrender' : function(){
Ext.getCmp('check').acctTpl.overwrite(Ext.getCmp('detailPanel').body, this.store.getAt(0).data,true);
}
}
});
Check.superclass.initComponent.apply(this, arguments);
}, //initComponent
डेटास्टोर से डेटा लोड किया जाता है & ठीक से प्रदर्शित लेकिन सिर्फ पंक्ति पर प्रकाश डाला नहीं है। क्या कोई मुझे बता सकता है कि मैं गलत कहां गया?
अरे आपकी प्रतिक्रिया के लिए धन्यवाद। मैंने पहले से ही उन तरीकों का प्रयास किया है लेकिन वे काम नहीं कर रहे हैं। मेरा ग्रिड पूरा हो गया है लेकिन किसी भी तरह से मैं पहली पंक्ति को हाइलाइट नहीं कर सकता। क्या कोई और तरीका है? –
क्या आपको उल्लिखित विधियों के साथ कोई त्रुटि मिल रही है? सभी कामकाज संभवतः आपको भविष्य में अतिरिक्त समस्याएं लाएंगे, इसलिए आप स्व-निर्मित कुछ भी करने से पहले मौजूदा तरीके से काम करने की कोशिश करेंगे। – Li0liQ
'getView()। GetRow' ExtJS 4 में मौजूद नहीं है; 'getView()। getNode' का उपयोग करें। –