#include<iostream>
#include <list>
#define FINISHED -1
#define NOCYCLE -2
using namespace std;
class Graph
{
int V;
int index;
list<int> *adj;
public:
Graph(int V);
void addEdge(int v, int w);
void set_index();
int Graph::isCyclicUtil(int v, bool visited[], int *cycleVertices, int parent);
};
Graph::Graph(int V)
{
this->V = V;
adj = new list<int>[V];
this->index = 0;
}
void Graph::set_index()
{
this->index = 0;
}
void Graph::addEdge(int v, int w)
{
adj[v].push_back(w);
adj[w].push_back(v);
}
int Graph::isCyclicUtil(int v, bool visited[], int *cycleVertices, int parent)
{
visited[v] = true;
list<int>::iterator i;
for (i = adj[v].begin(); i != adj[v].end(); ++i)
{
if (!visited[*i])
{
int result = isCyclicUtil(*i, visited, cycleVertices, v);
if (result == FINISHED)
return FINISHED;
else if (result != NOCYCLE) {
cycleVertices[index++] = v;
if (result == v)
return FINISHED;
else
return result;
}
}
else if (*i != parent) {
return *i;
}
}
return NOCYCLE;
}
int main()
{
bool *visited = new bool[4];
for (int i = 0; i < 4; i++)
visited[i] = false;
int cycleVertices[4];
for (int i = 0; i < 4; i++)
cycleVertices[i] = -1;
Graph g1(4);
g1.addEdge(0, 1);
g1.addEdge(1, 2);
g1.addEdge(2, 3);
g1.addEdge(3, 0);
g1.isCyclicUtil(3, visited, cycleVertices, -1) ? cout << "Graph contains cycle\n" :
cout << "Graph doesn't contain cycle\n";
int x = 0;
while (cycleVertices[x] != -1)
cout << cycleVertices[x++] << " ";
return 0;
}
这些是关于商店和网格的配置。我通过ajax请求加载数据;
var store = new Ext.data.JsonStore({
root: 'details',
fields: ['a1','a2','a3','a4','a5','a6','a7'],
pruneModifiedRecords:true,
autoload: false
});
var gridDetail = new Ext.grid.Panel({
title: 'Details',
store: store,
width : '100%',
header: {
titleAlign: 'center'
},
columns: [
{ text: 'col1', dataIndex: 'a1' },
{ text: 'col2', dataIndex: 'a2'},
{ text: 'col3', dataIndex: 'a3' },
{ text: 'col4', dataIndex: 'a4' },
{ text: 'col5', dataIndex: 'a5' },
{ text: 'col6', dataIndex: 'a6' },
{ text: 'col7', dataIndex: 'a7' },
],
});
我的返回JSON是;
{ “成功”:真, “第一”:[{...},], “详细信息”:[{ “A1”: “D1”, “A2”: “D2”,...“A7 “:” D7" }]}
但毕竟这并没有在网格上显示,也没有错误返回。一切都很好,但没有任何事情发生在网格中。显示的掩码然后未显示但网格上没有显示数据。
我的问题是什么,我看不到它?有人能帮助我吗?
答案 0 :(得分:0)
似乎对我有好处。也许是数据格式的东西。
向商店添加一个监听器,以检查商店获得的记录类型。
listeners:{ load: function( this, records, options ) { console.log(records); } }