Skip to content

Instantly share code, notes, and snippets.

@arturoleon
Created July 26, 2014 17:22
Show Gist options
  • Save arturoleon/67ec6c92b0d3ce12b5c5 to your computer and use it in GitHub Desktop.
Save arturoleon/67ec6c92b0d3ce12b5c5 to your computer and use it in GitHub Desktop.
Insertar fila dentro de TableView en posición específica
function click(){
console.log($.tabla.data[0].rows);
console.log("Añadiendo row en posición 3");
var fila = Ti.UI.createTableViewRow({
title: "Fila adicional insertada"
});
//http://www.w3schools.com/jsref/jsref_splice.asp
var filas = $.tabla.data[0].rows;
filas.splice(3, 0, fila);
$.tabla.data = filas;
}
$.index.open();
<Alloy>
<Window class="container">
<TableView id="tabla" onClick="click">
<TableViewRow title="Fila 1" />
<TableViewRow title="Fila 2" />
<TableViewRow title="Fila 3" />
<TableViewRow title="Fila 4" />
<TableViewRow title="Fila 5" />
<TableViewRow title="Fila 6" />
<TableViewRow title="Fila 7" />
<TableViewRow title="Fila 8" />
<TableViewRow title="Fila 9" />
<TableViewRow title="Fila 10" />
</TableView>
</Window>
</Alloy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment