找回密码
 立即注册

QQ登录

只需一步,快速开始

bgrimm_auto

初级会员

45

主题

156

帖子

423

积分

初级会员

积分
423

微信认证勋章

bgrimm_auto
初级会员   /  发表于:2018-4-8 12:21  /   查看:7621  /  回复:12
blob72751158.png
    <link href="../SpreadView/gc.spread.views.dataview.10.2.0.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="../easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script src="../SpreadView/common/gc.spread.common.10.2.0.min.js" type="text/javascript"></script>
    <script src="../SpreadView/gc.spread.views.dataview.10.2.0.min.js" type="text/javascript"></script>
    <script src="../SpreadView/plugins/gc.spread.views.gridlayout.10.2.0.min.js" type="text/javascript"></script>
    <script src="../SpreadView/common/gc.spread.common.10.2.0.min.js" type="text/javascript"></script>
    <script src="../SpreadView/licensen.js" type="text/javascript"></script>
    <script src="../SpreadView/locale/gc.spread.views.dataview.locale.zh-CN.10.2.0.min.js" type="text/javascript"></script>
    <link href="common.css" rel="stylesheet" />
    <script type="text/javascript">




       var data = [
     { "Id": 11074, "OrderDate": 35921, "RequiredDate": 35949, "ShipVia": 2, "Freight": 18.44, "ShipName": "Simons bistro", "ShipAddress": "Vinb&#230;ltet 34", "ShipCity": "Kobenhavn", "ShipPostalCode": "1734", "ShipCountry": "Denmark", "Employee": "Laura Callahan", "Customer": "Simons bistro", "ProductId": 16, "UnitPrice": 17.45, "Quantity": 14, "Discount": 0.05 },
     { "Id": 11075, "OrderDate": 35921, "RequiredDate": 35949, "ShipVia": 2, "Freight": 6.19, "ShipName": "Richter Supermarkt", "ShipAddress": "Starenweg 5", "ShipCity": "Genève", "ShipPostalCode": "1204", "ShipCountry": "Switzerland", "Employee": "Anne Dodsworth", "Customer": "Richter Supermarkt", "ProductId": 2, "UnitPrice": 19, "Quantity": 10, "Discount": 0.15 },
     { "Id": 11075, "OrderDate": 35921, "RequiredDate": 35949, "ShipVia": 2, "Freight": 6.19, "ShipName": "Richter Supermarkt", "ShipAddress": "Starenweg 5", "ShipCity": "Genève", "ShipPostalCode": "1204", "ShipCountry": "Switzerland", "Employee": "Anne Dodsworth", "Customer": "Richter Supermarkt", "ProductId": 46, "UnitPrice": 12, "Quantity": 30, "Discount": 0.15 },
     { "Id": 11038, "OrderDate": 35915, "RequiredDate": 35934, "ShippedDate": 35915, "ShipVia": 2, "Freight": 29.59, "ShipName": "Suprêmes délices", "ShipAddress": "Boulevard Tirou, 255", "ShipCity": "Charleroi", "ShipPostalCode": "B-6000", "ShipCountry": "Belgium", "Employee": "Andrew Fuller", "Customer": "Suprêmes délices", "ProductId": 71, "UnitPrice": 21.5, "Quantity": 30, "Discount": 0 }
            ];
            var dataView = new GC.Spread.Views.DataView(document.getElementById("grid1"), data, new GC.Spread.Views.Plugins.GridLayout());

12 个回复

倒序浏览
Clark.Pan讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2018-4-8 17:27:56
沙发
您好,您引了两次common,将后面那次删掉再试一下
image.png668811645.png
回复 使用道具 举报
bgrimm_auto
初级会员   /  发表于:2018-4-9 13:50:21
板凳
您好!
之前的问题好了,现在遇到加载数据的问题。
如下:前端调用一个函数,返回的数据应该是data2:
但是总是报错:


params.success(result.m_Item2, result.m_Item1); 此句就报错 请问这句应该如何修改,还是说调用函数返回部分修改

      params.success(data2.m_Item2, data2.m_Item1);//此句不报错
var data2 = { "m_Item1": 11, "m_Item2": [{ "CODE": "03020002001", "DateTime": "2018-04-09 00:00:00", "Indicator": "No.1球磨机给矿端加水流量累积量", "SortTag": "001", "RID": 3, "A_Shift": 0, "B_Shift": 0, "C_Shift": 0, "Day": 0, "Month": 0, "Year": 0 }, { "CODE": "03020002002", "DateTime": "2018-04-09 00:00:00", "Indicator": "No.1球磨机排矿端加水流量累积量", "SortTag": "002", "RID": 3, "A_Shift": 0, "B_Shift": 0, "C_Shift": 0, "Day": 0, "Month": 0, "Year": 0 }, { "CODE": "03020002003", "DateTime": "2018-04-09 00:00:00", "Indicator": "No.1球磨机返砂加水流量累积量", "SortTag": "003", "RID": 3, "A_Shift": 0, "B_Shift": 0, "C_Shift": 0, "Day": 0, "Month": 0, "Year": 0 }, { "CODE": "03020002004", "DateTime": "2018-04-09 00:00:00", "Indicator": "No.2球磨机给矿端加水流量累积量", "SortTag": "004", "RID": 3, "A_Shift": 0, "B_Shift": 0, "C_Shift": 0, "Day": 0, "Month": 0, "Year": 0 }, { "CODE": "03020002005", "DateTime": "2018-04-09 00:00:00", "Indicator": "No.2球磨机排矿端加水流量累积量", "SortTag": "005", "RID": 3, "A_Shift": 0, "B_Shift": 0, "C_Shift": 0, "Day": 0, "Month": 0, "Year": 0 }, { "CODE": "03020002006", "DateTime": "2018-04-09 00:00:00", "Indicator": "No.2球磨机返砂加水流量累积量", "SortTag": "006", "RID": 3, "A_Shift": 0, "B_Shift": 0, "C_Shift": 0, "Day": 0, "Month": 0, "Year": 0 }, { "CODE": "03020002007", "DateTime": "2018-04-09 00:00:00", "Indicator": "No.3球磨机给矿端加水流量累积量", "SortTag": "007", "RID": 3, "A_Shift": 0, "B_Shift": 0, "C_Shift": 0, "Day": 0, "Month": 0, "Year": 0 }, { "CODE": "03020002008", "DateTime": "2018-04-09 00:00:00", "Indicator": "No.3球磨机泵池补加水流量累积量", "SortTag": "008", "RID": 3, "A_Shift": 0, "B_Shift": 0, "C_Shift": 0, "Day": 0, "Month": 0, "Year": 0 }, { "CODE": "03020002009", "DateTime": "2018-04-09 00:00:00", "Indicator": "No.1球磨机用水流量累积量", "SortTag": "009", "RID": 3, "A_Shift": 0, "B_Shift": 0, "C_Shift": 0, "Day": 0, "Month": 0, "Year": 0 }, { "CODE": "03020002010", "DateTime": "2018-04-09 00:00:00", "Indicator": "No.2球磨机用水流量累积量", "SortTag": "010", "RID": 3, "A_Shift": 0, "B_Shift": 0, "C_Shift": 0, "Day": 0, "Month": 0, "Year": 0 }, { "CODE": "03020002011", "DateTime": "2018-04-09 00:00:00", "Indicator": "No.3球磨机用水流量累积量", "SortTag": "011", "RID": 3, "A_Shift": 0, "B_Shift": 0, "C_Shift": 0, "Day": 0, "Month": 0, "Year": 0 }] }

example.rar

5.72 KB, 下载次数: 182

回复 使用道具 举报
Clark.Pan讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2018-4-9 18:03:02
地板
您好,从代码上来看唯一区别是result和data2的区别,data2应该是您的全局数据源,所以相当于没有用到ajax返回的数据,所以也没有报错,您可以debug看一下result到底是什么东西,是否是json对象
回复 使用道具 举报
bgrimm_auto
初级会员   /  发表于:2018-4-10 08:53:05
5#
我后台返回的数据就是 data2,我只是把它直接拿到前端来了,dataview获取数据那块是我看你们的示例那么写的,所以不知道是否还有其他方法,还是那个方法在我这里不能用
回复 使用道具 举报
Clark.Pan讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2018-4-10 12:07:54
6#
还是我说的,您debug一下,看一下result的结果是什么
回复 使用道具 举报
bgrimm_auto
初级会员   /  发表于:2018-4-10 12:46:00
7#
ClarkPan 发表于 2018-4-10 12:07
还是我说的,您debug一下,看一下result的结果是什么

您好 我那个处理好了,ajax里面加了一句:dataType: "json",
还有一个问题就是 grid1的高度可以根据行高以及行数自动调整吗,我加一个行高为auto后就不显示了
回复 使用道具 举报
bgrimm_auto
初级会员   /  发表于:2018-4-10 12:46:04
8#
ClarkPan 发表于 2018-4-10 12:07
还是我说的,您debug一下,看一下result的结果是什么

您好 我那个处理好了,ajax里面加了一句:dataType: "json",
还有一个问题就是 grid1的高度可以根据行高以及行数自动调整吗,我加一个行高为auto后就不显示了
回复 使用道具 举报
Clark.Pan讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2018-4-10 17:48:25
9#
您好:
自适应行高参考:
demo.gcpowertools.com.cn/spreadjs/views/#/demos/AutoRowHeight
回复 使用道具 举报
bgrimm_auto
初级会员   /  发表于:2018-4-11 08:59:33
10#
ClarkPan 发表于 2018-4-10 17:48
您好:
自适应行高参考:
demo.gcpowertools.com.cn/spreadjs/views/#/demos/AutoRowHeight

您好 不是行高 是整个容纳 行的grid的高度,不想在显示后留有空白
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部