我有一个问题,萤火虫没有告诉我任何问题:/
我的funcions.js
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
Ext.require([
'Ext.grid.*',
'Ext.data.*',
'Ext.util.*',
'Ext.state.*'
]);
Ext.onReady(function() {
Ext.QuickTips.init();
// setup the state provider, all state information will be saved to a cookie
Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));
var store = Ext.create('Ext.data.Store', {
autoLoad: true,
proxy: {
type: 'ajax',
url: 'src.php'
}
});
var grid = Ext.create('Ext.grid.Panel', {
store: store,
stateful: true,
collapsible: true,
multiSelect: true,
stateId: 'stateGrid',
columns: [
{
text : 'Nombre Chofer',
flex : 1,
sortable : false,
dataIndex: 'nombre_chofer'
}
],
height: 350,
width: 600,
title: 'Array Grid',
renderTo: 'grid-example',
viewConfig: {
stripeRows: true,
enableTextSelection: true
}
});
});
我的 src.php (AJAX)
<?php
include_once 'funciones/header_server.php';
include_once 'model/ChoferModel.php';
function getList() {
$choferModel = new ChoferModel();
$resultQuery = $choferModel->getTable();
$conteo = count($resultQuery) - 1;
$resultQuery = (array) $resultQuery;
if ($conteo > 0) {
foreach ($resultQuery as $chofer) {
$rec['nombre_chofer'] = $chofer['NOMBRE_CHOFER'];
$arr[] = $rec;
}
$jsonresult = JEncode($arr);
echo $jsonresult;
}
}
getList();
还有我的 index.php
<?php
//include_once 'funciones/header_server.php';
//include_once 'model/ChoferModel.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Sistema para control de viaticos - COPRA</title>
<link rel="stylesheet" type="text/css" href="script/ext-all.css" />
<script type="text/javascript" charset="utf-8" src="script/ext-all-dev.js"></script>
<script type="text/javascript" charset="utf-8" src="script/ext.js"></script>
<script src="script/funcions.js"></script>
</head>
<body>
<div id="grid-example" name="grid-example"></div>
</body>
</html>
我的输出是黑色的,不显示表格或网格...请帮助我..
截图:src 输出:http: //i.stack.imgur.com/zLMgz.png