DataDriver.html

class webix.DataDriver.html()

Datadriver.html mixin

References

helpers
toNode().

External references

Official documentation page.

Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
webix.DataDriver.html={
    /*
        incoming data can be
         - ID of parent container
         - HTML text
    */
    toObject:function(data){
        if (typeof data == "string"){
         var t=null;
         if (data.indexOf("<")==-1)    //if no tags inside - probably its an ID
            t = webix.toNode(data);
         if (!t){
            t=document.createElement("DIV");
            t.innerHTML = data;
         }

         return t.firstChild;
        }
        return data;
    },
    //get array of records
    getRecords:function(node){
        return node.getElementsByTagName(this.tag);
    },
    //get hash of properties for single record
    getDetails:function(data){
        return webix.DataDriver.xml.tagToObject(data);
    },
    getOptions:function(){
        return false;
    },
    //dyn loading is not supported by HTML data source
    getInfo:function(data){
        return {
            size:0,
            from:0
        };
    },
    tag: "LI"
};