简体   繁体   English

webix数据表从列到行

[英]webix datatable column wise to row wise

hey guys im facing a problem in webix where i want to display as rowwise but im not able to find how to display it in that way i can display it in column wise its taken from the database data was converted to json format. 大家好,我在webix中遇到问题,我想按行显示,但我找不到以这种方式显示的方法,我可以按列显示它,它取自数据库数据,已转换为json格式。 here is the code snipet, pls give me some suggestions 这是代码片段,请给我一些建议

 <script type="text/javascript"> webix.ajax("datacon.php", function(text, incomingData){ //text = '{ some :"abc"}' var data=incomingData.json(); webix.ui({ container: "box", rows:[ {view:"template", type:"header", template: "some text"}, {view: "datatable", data: data, height: 300, columns:[ {id:"date", header:"Date"}, {id:"ob", header:"OB"}, {id:"ore", header:"ORE"}, {id:"stratio", header:"Stripping Ratio"} ] } ] }); 

Actually your code is not working properly. 实际上,您的代码无法正常工作。 It shows error in the snippet, please check. 该代码段显示错误,请检查。

Also, in above code, you have to mention a view type such as "view : datatable/list/tree" or any of these. 另外,在上面的代码中,您必须提及一种视图类型,例如“ view:datatable / list / tree”或其中的任何一种。 Make changes and revert back. 进行更改并还原。

In webix DataTable you can't add a single row. 在webix DataTable中,您不能添加一行。 You have to write data according to its print pattern. 您必须根据其打印模式写入数据。

Here's a simple example of datatable from webix 这是来自webix的数据表的简单示例

 <script src="https://cdn.webix.com/edge/webix.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.webix.com/edge/webix.css"> <script> var datatable = webix.ui({ view:"datatable", columns:[ { id:"rank", header:"", width:50}, { id:"title", header:"Film title", width:200}, { id:"year", header:"Released", width:80}, { id:"votes", header:"Votes", width:100} ], data: [ { id:1, title:"The Shawshank Redemption", year:1994, votes:678790, rank:1}, { id:2, title:"The Godfather", year:1972, votes:511495, rank:2} ] }); </script> 

You just have to match your "Id" with the respective data tags. 您只需要将“ Id”与相应的数据标签进行匹配即可。 Id referred in the column section should be identical with the "Keys" of the data file. 列部分中引用的ID应与数据文件的“键”相同。 Also the titles of the column are set using the "header" parameter. 列的标题也使用“ header”参数设置。

These are some of the tools that are useful for faster development using webix. 这些工具对于使用Webix进行更快的开发非常有用。

  1. https://webix.com/skin-builder/?utm_source=newsletter&utm_medium=email&utm_campaign=3_free_tools_to_create_awesome_apps&utm_term=2017-09-26 https://webix.com/skin-builder/?utm_source=newsletter&utm_medium=email&utm_campaign=3_free_tools_to_create_awesome_apps&utm_term=2017-09-26

  2. https://webix.com/form-builder/?utm_source=newsletter&utm_medium=email&utm_campaign=3_free_tools_to_create_awesome_apps&utm_term=2017-09-25 https://webix.com/form-b​​uilder/?utm_source=newsletter&utm_medium=email&utm_campaign=3_free_tools_to_create_awesome_apps&utm_term=2017-09-25

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM