Показать сообщение отдельно
  #4 (permalink)  
Старый 30.08.2010, 23:18
Аспирант
Отправить личное сообщение для DenQ Посмотреть профиль Найти все сообщения от DenQ
 
Регистрация: 28.08.2010
Сообщений: 57

Случайно так зашел, думаю, дай гляну, может ответил кто...
В общем, сделал следующим вечером, следующим образом:
<?php
    if (($_REQUEST) && ($_REQUEST['ajax_request']) == 'yes') {
        $mas = array('company'=>'cas', 'price'=>'ds');
            $all = array($mas, $mas);
            echo json_encode($all);
            exit();
    }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css" />
        <link rel="stylesheet" type="text/css" href="ext/examples/grid/grid-examples.css" />

        <script type="text/javascript" src="js/ext/adapter/ext/ext-base.js"></script>
        <script type="text/javascript" src="js/ext/ext-all.js"></script>
        <script type="text/javascript" src="js/grid-example.js"></script>
    </head>
    <body>
        <div id="b1"></div>
        <div id="grid-example"></div>

    </body>
</html>
Ext.onReady(function(){
    // create the data store
	var myStore = new Ext.data.ArrayStore( {
		proxy: new Ext.data.HttpProxy({
			url     	: 'index.php',
			method  	: 'POST'
		} ),
		baseParams: {
			ajax_request		: "yes"
		},
		reader: new Ext.data.JsonReader({
//			id				: 'id',
			root            	: 'cast',
			totalProperty   	: 'total'
		}),
		fields: [
		{
			name		: 'company',
			mapping         : 'company',
			type		: 'string'
		}, {
			name		: 'price',
			mapping         : 'price',
			type		: 'string'
		}
		],
		listeners :{
			load : function(s, rec, obj){
				alert(s.getCount());
			}
		}

	});
	myStore.load();

    // create the Grid
    var grid = new Ext.grid.GridPanel( {
        store	: myStore,
        columns: [
			{
				id		: 'company',
				header	: 'Company',
				width	: 160,
				sortable	: true,
				dataIndex	: 'company'
			}, {
				header	: 'Price',
				sortable	: true,
				width	: 75,
				dataIndex	: 'price'
			}
        ],
        autoExpandColumn	: 'company',
        height			: 350,
        width			: 600,
        title			: 'Array Grid',
    });


    grid.render('grid-example');
});

Подскажите, если что неправильно, пожалуйста...
Ответить с цитированием