View Full Version : textfield fill data

4 Nov 2012, 10:59 AM
hi everybody,

my english is not so good.
i use translatorsoftware......

I want my text box to fill only as json?
would love a script for .... I'm here all the time in vain in the forum ....

4 Nov 2012, 10:55 PM
Hi, You cannot fill the text field with JSON. You need to encode/ decode the object (your JSON) based on your need. You can use like
var myJSon, panel;

myJSon = ['{"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ] } }}'];

panel = Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
title: 'JSON',
width: 600,
bodyPadding: 10,
layout: 'anchor',
items: [{
xtype: 'textfield',
value: Ext.encode(myJSon)