123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- define(function (require, exports, module) {
- return function () {
- var test1 = require('/yvanui/example/test1.js');
- var test2 = require('/yvanui/example/test2.js');
- var root = {
- center: {
- border: false,
- items: {
- xtype: 'div',
- id: 'thediv',
- items: [
- {
- xtype: 'toolbar',
- title: ' ',
- items: [{
- text: '读取', onClick: function () {
- console.log($(this).up('power').down('div').formGet());
- }
- }, {
- text: '找Item', onClick: function () {
- $(this).up('power').down('div').item('b1').textbox('setValue', '找到b1');
- $(this).up('power').down('div').item('c2').textbox('setValue', '找到c2');
- }
- }, {
- text: '改值1', onClick: function () {
- $(this).up('power').down('div').formSet({
- a1: 'aaaa1',
- a6: 'aaaa6',
- tf3: {
- c1: "ccc!c1-m1",
- c2: "ccc!c2-m2",
- c3: "ccc!c3-m2",
- c4: "ccc!c4-m2"
- },
- tf4: {
- beActive: 'Y'
- }
- });
- }
- }, {
- text: '改值2', onClick: function () {
- $(this).up('power').down('div').formSet({
- a1: '改了!a1',
- a6: '改了!a6',
- tf3: {
- c1: "改了!c1-m1",
- c2: "改了!c2-m2",
- c3: "改了!c3-m2",
- c4: "改了!c4-m2"
- },
- tf4: {
- beActive: 'N'
- }
- });
- }
- }, {
- text: '清空', onClick: function () {
- $(this).up('power').down('div').formClear();
- }
- }, {
- text: 'Combobox1', onClick: function () {
- $('#cgg1').formSet({
- cb1: 'v11',
- cb2: 'v21',
- cb3: 'v31'
- });
- }
- }, {
- text: 'Combobox2', onClick: function () {
- $('#cgg1').formSet({
- cb1: 'v13',
- cb2: 'v23',
- cb3: 'v33'
- });
- }
- }]
- },
- {
- xtype: 'group',
- title: 'Combobox', items: {
- xtype: 'form', id: 'cgg1', items: [[
- {
- label: 'cb1', name: 'cb1', xtype: 'combobox', data: test1,
- required: true,
- }, {
- label: 'cb2', name: 'cb2', xtype: 'combobox', data: test2,
- required: true,
- }, {
- label: 'cb3', name: 'cb3', xtype: 'combobox',
- required: true,
- data: [
- { id: 'v31', text: 't31' },
- { id: 'v32', text: 't32' },
- { id: 'v33', text: 't33' },
- { id: 'v34', text: 't34' }
- ]
- },
- ]]
- }
- },
- {
- xtype: 'group',
- title: '平级对象', items: {
- //如果 form 没名字,视为当前对象
- xtype: 'form', items: [[
- { label: 'a1', name: 'a1', value: 'a1' },
- {
- xtype: 'form', items: [[
- { label: 'a2', name: 'a2', value: 'a2' },
- { label: 'a3', name: 'a3', value: 'a3' }
- ]]
- },
- { label: 'a4', name: 'a4', value: 'a4' },
- { label: 'a5', name: 'a5', value: 'a5' },
- { label: 'a6', name: 'a6', value: 'a6' }
- ]]
- }
- },
- {
- xtype: 'group',
- title: '独立表单-tf1', items: {
- //如果 form 有名字,则视为子对象
- xtype: 'form', id: 'tf1', name: 'tf1', items: [[
- { label: 'b1', name: 'b1', value: 'b1' },
- { label: 'b2', name: 'b2', value: 'b2' },
- { label: 'b3', name: 'b3', value: 'b3' }
- ]]
- }
- },
- {
- xtype: 'group',
- title: '独立表单-tf2', items: {
- //如果 form 有名字,则视为子对象
- xtype: 'form', name: 'tf2', items: [[
- { label: 'b2', name: 'b2', value: 'b2' },
- { label: 'b3', name: 'b3', value: 'b3' },
- { label: 'b4', name: 'b4', value: 'b4' }
- ]]
- }
- },
- {
- xtype: 'group',
- title: '合并表单1-tf3', items: {
- //如果 form 有相同名字,视为合并
- xtype: 'form', name: 'tf3', items: [[
- { label: 'c1', name: 'c1', value: 'c1-m1' },
- { label: 'c2', name: 'c2', value: 'c2-m1' },
- { label: 'c3', name: 'c3', value: 'c3-m1' }
- ]]
- }
- },
- {
- xtype: 'group',
- title: '合并表单2-tf3', items: {
- //如果 form 有相同名字,视为合并
- xtype: 'form', name: 'tf3', items: [[
- { label: 'c2', name: 'c2', value: 'c2-m2' },
- { label: 'c3', name: 'c3', value: 'c3-m2' },
- { label: 'c4', name: 'c4', value: 'c4-m2' }
- ]]
- }
- },
- {
- xtype: 'group',
- title: '表单重名视为数组-tf4', items: {
- //如果 form 有相同名字,视为合并
- xtype: 'form', name: 'tf4', items: [[
- { label: 'd1', name: 'd1', value: 'd1-m1' },
- { label: 'd1', name: 'd1', value: 'd1-m2' },
- { label: 'd4', name: 'd4', value: 'd4' },
- {
- xtype: 'combobox', name: 'beActive', label: '是否活动',
- data: [
- { id: 'Y', text: '是' },
- { id: 'N', text: '否' }
- ]
- }
- ]]
- }
- }]
- }
- }
- };
- return root;
- };
- });
|