This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.widget("ir.itemrenderer", { | |
options: { | |
/** type string, name of widget to use as renderer */ | |
itemRenderer:null, | |
/** type function, function that will be executed on each iteration*/ | |
rendererFunction:null, | |
/** type function, function to process the label that will be used */ | |
labelFunction:null, | |
/** type string, name of the field to use as the label */ | |
labelField:null, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function () { | |
var itemrendererOptions = { | |
dataProvider: ["lorem", "lipsum", "dolor", "sit"] | |
}; | |
$("#itemrenderer").itemrenderer(itemrendererOptions); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function () { | |
var itemrendererOptions = { | |
dataProvider: [ | |
{ | |
label: "lorem" | |
}, | |
{ | |
label: "lipsum" | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function () { | |
var itemrendererOptions = { | |
labelField: "name", | |
dataProvider: [ | |
{ | |
name: "lorem" | |
}, | |
{ | |
name: "lipsum" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var itemrendererOptions = { | |
labelFunction: function (data, options) { | |
return "$ " + data.price; | |
}, | |
dataProvider: [ | |
{ | |
name: "lorem", | |
price: 123.34 | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var itemrendererOptions = { | |
labelField: "name", | |
labelFunction: function (data, options) { | |
return data[options.labelField] + " is $ " + data.price; | |
}, | |
dataProvider: [ | |
{ | |
name: "lorem", | |
price: 123.34 | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var itemrendererOptions = { | |
labelField: "name", | |
rendererFunction: function (container, listData) { | |
if(listData.data.price > 100) { | |
container.css("color","red"); | |
} | |
container.html(listData.label); | |
}, | |
dataProvider: [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create a custom widget to be attached to each of the items created. | |
$.widget("ui.customwidget", { | |
options: { | |
listData:null | |
}, | |
_create: function (){ | |
this.element.addClass("ui-customwidget"); | |
$("<span></span>") | |
.text(this.options.listData.data.name + " is $" + this.options.listData.data.price) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var requeiredFieldOptions = { | |
watermarkText: "Enter age here...", | |
functionValidate: function(value) { | |
if (parseInt(value) < 18) { | |
return false; | |
} | |
return true; | |
}, | |
dataType: "number", | |
liveCheck: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parse = (obj, path) -> | |
path = path.split(/[\[\]\.]+/) | |
path.pop() if path[path.length - 1] is "" | |
while path.length and (obj = obj[path.shift()]) | |
; | |
obj |
OlderNewer