Code Monkey home page Code Monkey logo

douglashennrich.dhennrich.picker's Introduction

Quick Start

Get it gitTio

Download this repository and consult the Alloy Documentation on how to install it, or simply use the gitTio CLI:

$ gittio install dhennrich.picker

How it looks like

.Imagem

XML

Add the widget below all your code.

<Alloy>
    <Window>
        <View>
            <Label id="Label">Something</Label>
        </View>

        <!-- Picker -->
        <Widget src="dhennrich.picker" id="picker"/>
    </Window>
</Alloy>

JS

When you want to display the picker

/*
@ formData
*/
function formData(json){
    var _arr = [];

    console.log('json: ', json);

    for(var i = 0; i < json.length; i++){
        _arr[i] = {
            title: json[i].title
          , data: json[i]
        }
    }

    /*
    _arr[json.length] = {
        title: "Custom Option"
      , data: null
    }
    */

    return _arr;
};

/*
@ _callbackSelect
*/
function _callbackSelect(){
    var _args = arguments[0] || {};

    if(_args.result/* _arr[i].data */){

        // Do something with selected data ( previous json[i])
    }else{

        // Do something with custom option ( previous _arr[json.length] )
    }
};

//
$.picker.show({
    data: formData(yourArr)
  , selectFunc: _callbackSelect
  , selectTitle: "Custom Select Title"
  /*
  , cancelFunc: _callbackCancel
  , cancelTitle: "Custom Cancel Title"
  */
});

TSS

You can customize your picker on app.tss file.

  • #DHpickerBG is the role background of the view.
{
    backgroundColor: "#8000"
}
  • #DHpickerView is the background of picker.
{
    backgroundColor: "#fff"
}
  • #DHpickerCancelarBtn and #DHpickerSelecionarBtn are cancel and select button.

Exposed Function

  • show

$.idWidget.show({ data: formData(array) , selectFunc: callback })

douglashennrich.dhennrich.picker's People

Contributors

douglashennrich avatar

Watchers

James Cloos avatar Brenton House avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.