By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 904 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

how to load data in extjs using codeigniter

P: 1
This is my view page
Expand|Select|Wrap|Line Numbers
  1. <html> <head> <title>Codeigniter & Extjs </title> <Link rel="stylesheet" type="text/css" href=" <?php echo base_url();?>/ext/resources/css/ext-all.css"> <script type="text/javascript" src="<?=base_url()?>/ext/ext-all-debug.js"> </script> <head> <body> <script type="text/javascript">
  2.  
  3. Ext.define('Person', {
  4.     extend: 'Ext.data.Model',
  5.     fields: [{
  6.         name: 'id',
  7.         type: 'int',
  8.         useNull: true
  9.     }, 'first', 'last', 'age'],
  10.     validations: [{
  11.         type: 'length',
  12.         field: 'first',
  13.         min: 1
  14.     }, {
  15.         type: 'length',
  16.         field: 'last',
  17.         min: 1
  18.     }, {
  19.         type: 'length',
  20.         field: 'age',
  21.         min: 1
  22.     }]
  23. });
  24.     var store = Ext.create('Ext.data.Store', {
  25.         model: 'Person',
  26.         proxy: {
  27.             type: 'ajax',
  28.             url: '<?=base_url()?>index.php/welcome/get',
  29.             reader: {
  30.                 type: 'json',
  31.                 rootProperty: 'data'
  32.             },
  33.  
  34.         }
  35.     });
  36.  
  37.     var grid = Ext.create('Ext.grid.Panel', {
  38.         renderTo: document.body,
  39.         width: 500,
  40.         height: 330,
  41.         frame: true,
  42.         title: 'User Info',
  43.         store: store,
  44.         //iconCls: 'icon-user',
  45.         columns: [ {
  46.             text: 'First Name',
  47.             flex: 1,
  48.             sortable: true,
  49.             dataIndex: 'first',
  50.             field: {
  51.                 xtype: 'textfield'
  52.             }
  53.         }, {
  54.             header: 'Last Name',
  55.             width: 120,
  56.             sortable: true,
  57.             dataIndex: 'first',
  58.             field: {
  59.                 xtype: 'textfield'
  60.             }
  61.         }, {
  62.             text: 'Age',
  63.             width: 120,
  64.             sortable: true,
  65.             dataIndex: 'last',
  66.             field: {
  67.                 xtype: 'textfield'
  68.             }
  69.         }],
  70.         dockedItems: [{
  71.             xtype: 'toolbar',
  72.             items: [{
  73.                 text: 'Add',
  74.                // iconCls: 'icon-add',
  75.                 handler: function()
  76.                 {
  77.                     // empty record
  78.                    // store.insert(0, new Person());
  79.                    // rowEditing.startEdit(0, 0);
  80.                 }
  81.             }, '-', {
  82.                 itemId: 'delete',
  83.                 text: 'Delete',
  84.                // iconCls: 'icon-delete',
  85.                 disabled: true,
  86.                 handler: function(){
  87.                     var selection = grid.getView().getSelectionModel().getSelection()[0];
  88.                     if (selection) {
  89.                         store.remove(selection);
  90.                     }
  91.                 }
  92.             }]
  93.         }]
  94.     });
  95.     grid.getSelectionModel().on('selectionchange', function(selModel, selections){
  96.         grid.down('#delete').setDisabled(selections.length === 0);
  97.     });
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.     </script> <body> </html>
Dec 11 '15 #1
Share this Question
Share on Google+
1 Reply


zmbd
Expert Mod 5K+
P: 5,371
and your actual question is?
Dec 12 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.