
Originally Posted by
evant
How are we supposed to know? You haven't posted the relevant code.
Ok, sorry . But i think its not code's problem .
Code:
// Success action form response
success: function(form, action){
var response_obj = Ext.util.JSON.decode(action.response.responseText);
document.getElementById('center').innerHTML = response_obj.response_article.article; // its text + spans
var spans = Ext.query("#center span");
for(var i=0; i<spans.length; i++) {
Ext.EventManager.addListener(spans[i], 'click', handle_span_click);
Ext.DomHelper.applyStyles(spans[i], 'background-color: #90ded2;');
}
Ext.getCmp('center_panel').body.highlight('#c3daf9', {block: true});
}
});
So here i got reponse with text and spans , they are showed inline, everything ok .
So now i have like this:
"word1 word2 <span>word3</span> word4
word5 <span>word6</span> word7" .
Code:
// handle span click event function
var handle_span_click = function handle_span_click(ev, target) {
if(target.getElementsByTagName('input').length < 1) {
// here im making store, dont show
prev_value = target.innerHTML;
target.innerHTML = '';
var input = new Ext.Element(document.createElement('input'));
input.appendTo(target);
var combo = new Ext.form.ComboBox({
store: store,
displayField: 'syns',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
value: prev_value,
selectOnFocus:true,
applyTo: input,
listeners: {
select: handle_select_change
}
});
}
};
So now if you click span - combobox appear .
But now data , that i showed before, will look like:
"word1 word2 word4
<span>word3</span> word5 word7
<span>word6</span> " .
And i cant understand, why do they float left .
All i need is : 1) appear combobox normally, as span 2) after select event got fired - delete combobox and update span with selected value ( and also save all markup .. )
Thx