小编sve*_*tlo的帖子

带有代理的extjs树存储

我正在创建一个MVC extjs应用程序。我有一个带有商店的treepanel,它正在从php源加载数据。我收到以下json格式的响应:

[
{
    "text": "Home",
    "leaf": true,
    "dbName": "NULL",
    "children": []
},
{
    "text": "Moje Firma s.r.o.",
    "leaf": false,
    "expanded": false,
    "children": [
        {
            "text": "Vydane",
            "leaf": true,
            "dbName": "demo"
        },
        {
            "text": "Prijate",
            "leaf": true,
            "dbName": "demo"
        }
    ]
},
{
    "text": "Já Živnostník",
    "leaf": false,
    "expanded": false,
    "children": [
        {
            "text": "Vydane",
            "leaf": true,
            "dbName": "demo_de"
        },
        {
            "text": "Prijate",
            "leaf": true,
            "dbName": "demo_de"
        }
    ]
},
{
    "text": "Nezisková organizace",
    "leaf": false,
    "expanded": false,
    "children": [ …
Run Code Online (Sandbox Code Playgroud)

extjs store models treepanel

4
推荐指数
1
解决办法
5485
查看次数

extjs嵌套模型

我是Sencha Extjs的新手,我遇到了模型设计问题.以下是来自服务器的示例响应:

[
{
    "success": "true",
    "data": {
        "sromain": [
            {
                "corporation": "DEV 1 s.r.o.",
                "dbName": "dev_1_s_r_o_",
                "prijmyCelk": "2 106,00 €",
                "nakladyCelk": "2 049,00 €",
                "ziskCelk": "57,00 €",
                "neuhrVydCelk": "2 106,00 €",
                "neuhrPrijCelk": "2 049,00 €",
                "dph": "9,52 €"
            }
        ],
        "branches": [
            {
                "branch_name": "Bratislava",
                "branch_code": "BA",
                "strediskoprijmyCelk": "180,00 €",
                "strediskonakladyCelk": "0,00 €",
                "strediskoziskCelk": "180,00 €",
                "strediskoneuhrVydCelk": "180,00 €",
                "strediskoneuhrPrijCelk": "0,00 €",
                "streddphCelk": "30,00 €"
            },
            {
                "branch_name": "Banská Bystrica",
                "branch_code": "BB",
                "strediskoprijmyCelk": "600,00 €",
                "strediskonakladyCelk": "0,00 €",
                "strediskoziskCelk": …
Run Code Online (Sandbox Code Playgroud)

json nested model extjs

1
推荐指数
1
解决办法
5907
查看次数

多线程 - 类中的异步线程

我有一个类Foo,它有一个主函数和执行函数.我想用execute函数启动一个未知数量的线程,但是当我尝试编译代码时,我总是得到error C2064: term does not evaluate to a function taking 1 arguments.

foo.h中

#ifndef BOT_H
#define BOT_H

#pragma once
#include <WinSock2.h>
#include <WS2tcpip.h>
#include <string>
class foo
{
public:
    foo(char *_server, char *_port);
    ~foo(void);
private:
    char *server;
    char *port;

    void execute(char *cmd);
    void main();
};

#endif
Run Code Online (Sandbox Code Playgroud)

foo.c的

#include <thread>
#include "bot.h"
#include "definitions.h"

using namespace std;
foo::foo(char *_server, char *_port){
        ...
}

bot::~bot(void) {
        ...
}
void bot::execute(char *command){
    ...
}
    void bot::main(){
        thread(&bot::execute, (char*)commanda.c_str()).detach();
    }
Run Code Online (Sandbox Code Playgroud)

我应该如何从类成员函数创建线程?

谢谢你的回答

c++ multithreading c++11

0
推荐指数
1
解决办法
83
查看次数

对象/数组中的FOR循环

我正在使用python创建一个应用程序.我发出HTTP请求并获得以下结果:

{
    "companies": {
        "company": [
            {
                "createDt": "2014-01-18T00:00:00+01:00",
                "dbNazev": "sveatlo_s_r_o_",
                "id": "1",
                "licenseGroup": "null",
                "nazev": "Sveatlo s.r.o.",
                "show": "true",
                "stavEnum": "ESTABLISHED",
                "watchingChanges": "false"
            },
            {
                "createDt": "2014-01-20T00:00:00+01:00",
                "dbNazev": "hajocka",
                "id": "2",
                "licenseGroup": "null",
                "nazev": "HájoÄka",
                "show": "true",
                "stavEnum": "ESTABLISHED",
                "watchingChanges": "false"
            }
        ]
    }
}
Run Code Online (Sandbox Code Playgroud)

然后我在for循环中处理数据.问题是响应也可能如下所示:

{
    "companies": {
        "company": {
            "createDt": "2014-01-18T00:00:00+01:00",
            "dbNazev": "sveatlo_s_r_o_",
            "id": "1",
            "licenseGroup": "null",
            "nazev": "Sveatlo s.r.o.",
            "show": "true",
            "stavEnum": "ESTABLISHED",
            "watchingChanges": "false"
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

目前我正在检查这样的每个请求后是否是一个数组,但我觉得这不是最好的方法.有人可以帮我找一个更好的解决方案吗?

谢谢你的回答.

编辑:我无法更改服务器的响应

python

0
推荐指数
1
解决办法
202
查看次数

标签 统计

extjs ×2

c++ ×1

c++11 ×1

json ×1

model ×1

models ×1

multithreading ×1

nested ×1

python ×1

store ×1

treepanel ×1