有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

javascript屏蔽ui wicket数据源

我正在尝试用wicket和java实现shield ui弹出式编辑。我的html和java代码:

<div id="grid2">
<script type="text/javascript">
$(document).ready(function () {
    $("#grid2").shieldGrid({
        dataSource: {
            /*remote: {
                    //read: ""
                    //return "Leyendo";
            },*/
            data: "datasource",
            schema: {
                fields: {
                    ID: { path: "ID", type: Number },
                    Name: { path: "Name", type: String },
                    Age: { path: "Age", type: Number },
                    BirthDate: { path: "BirthDate", type: Date },
                    Active: { path: "Active", type: Boolean }
                }
            }
        },
        paging: {
            pageSize: 15
        },
        rowHover: true,
        columns: [
           { field: "Name", title: "Nombre"},
            { field: "Age", title: "Direccion", width: "100px" },
            { field: "BirthDate", title: "Fecha", format: "{0:dd/MM/yyyy}" },
            { field: "Active", title: "Activo", width: "70px" },
            {
                width: 150,
                title: "Modificar ",
                buttons: [
                    { commandName: "edit", caption: "Editar" },
                    { commandName: "delete", caption: "Eliminar" }
                ]
            }
        ],
        editing: {
            enabled: true,
            mode: "popup",
            confirmation: {
                "delete": {
                    enabled: true,
                    template: function (item) {
                        return "Eliminar abastecimiento con id '" + item.Name + "'?";
                    }
                }
            }
        },
        toolbar: [
            {
                buttons: [
                    { commandName: "insert", caption: "Agregar" }
                ],
                position: "top"
           }
        ]
    });
});
</script>
</div>


<p></p>
</div>

Java的代码是:

DataSource datasource = new DataSource("datasource");
DataSourceOptions options = datasource.getOptions();

options.setData(
        new HashMap() {{
                  put("ID", 1);
                  put("Name", "Item1");
                  put("Age", 45);
                  put("BirthDate", "16/08/2006");
                  put("Active", false);
        }},
        new HashMap() {{
                  put("ID", 2);
                  put("Name", "Item2");
                  put("Age", 45);
                  put("BirthDate", "16/08/2006");
                  put("Active", false);
        }},
        new HashMap() {{
                  put("ID", 3);
                  put("Name", "Item3");
                  put("Age", 45);
                  put("BirthDate", "16/08/2006");
                  put("Active", false);
        }},
        new HashMap() {{
                  put("ID", 4);
                  put("Name", "Item4");
                  put("Age", 45);
               put("BirthDate", "16/08/2006");
                  put("Active", false);
        }}
);

add(datasource);
//END testing shieldui          

没有关于为网格编辑实现datasource的文档,所以我尝试了使用remote和datat标记的所有组合,以便从java代码中获取数据。没有成功

当我部署我的war时,我得到一个网格,其中有几行字段BirthData中的当前日期,但所有其他字段都为空

我不知道数据来自哪里,如果我从html文件中删除数据:“datasource”,我只会得到网格头,没有数据

如果您有任何建议,我们将不胜感激


共 (0) 个答案