1
votes

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. 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"}
                        ]
                    }

                ]
            }); 
1

1 Answers

0
votes

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. Make changes and revert back.

In webix DataTable you can't add a single row. You have to write data according to its print pattern.

Here's a simple example of datatable from 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 referred in the column section should be identical with the "Keys" of the data file. Also the titles of the column are set using the "header" parameter.

These are some of the tools that are useful for faster development using 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

  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