ValYouW / jqPropertyGrid

A small property grid in JS to view/edit POJOs
MIT License
57 stars 33 forks source link

Cant use CustomType #21

Closed zertex closed 5 years ago

zertex commented 5 years ago

My custom type not work... What I do wrong?

Define custom types

const additionalTypes = {
    alignSelect: { // name of custom type
        html: function(elemId, name, value, meta) { 
            let onclick = '';
            return '<select name="' + name + '" id="' + name + '" class="alignpicker">'+
                '<option value="left">Слева</option>'+
                '<option value="center">По центру</option>'+
                '<option value="right">Справа</option>'+
                '</select>';
        },
        valueFn: false
    }
};

Define parts

...
const theOptionMeta = {
...
'align: { group: "Align", name: "Placement", type: "alignSelect", options:[]},
...
}

Init properties

$("#params-element").jqPropertyGrid(theOptionObj, {meta: theOptionMeta, customTypes: additionalTypes});
zertex commented 5 years ago

Sorry, npm not load needed version