Jason Cochran
Posts: 0
Joined: Thu Aug 16, 2012 2:46 am

How to programatically add/delete rows of a grid?

How do I programatically add/delete rows of a grid? Similar how you would do it with a list.

Let's say I have a field for the title and an "Add" button above my grid.

1) When I click the button a new row with two columns will be added to the grid.
2) The value of the title field is added to the left-hand column of the grid. The right-hand column of the grid will have a delete button.
3) When I click the delete button that row of the grid will be deleted.

Code to add rows to a list:

var list = Tiggr("mylist");
var title = Tiggr("txtTitle").val();
if(title == "") {
alert("You must enter a Title!");
return;
}
list.append("lia rel="nofollow"" + title + "/a/li").listview("refresh");
Tiggr("txtTitle").val("");

~ Jason

Jason Cochran
Posts: 0
Joined: Thu Aug 16, 2012 2:46 am

How to programatically add/delete rows of a grid?

What would also be nice is if there was a way to create a split list.

http://jquerymobile.com/test/docs/lis...

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to programatically add/delete rows of a grid?

The Grid is our component, so just get the tr element and then duplicate it or delete it.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to programatically add/delete rows of a grid?

We'll add in our new HTML5 builder.

Jason Cochran
Posts: 0
Joined: Thu Aug 16, 2012 2:46 am

How to programatically add/delete rows of a grid?

cool, thanks!

do you have any sample code for manipulating the grid (adding\deleting rows)?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to programatically add/delete rows of a grid?

Sorry, no. Use jQuery to select the elements in the DOM and then add/remove rows.

Jason Cochran
Posts: 0
Joined: Thu Aug 16, 2012 2:46 am

How to programatically add/delete rows of a grid?

OK. So it is essentially a table?

Jason Cochran
Posts: 0
Joined: Thu Aug 16, 2012 2:46 am

How to programatically add/delete rows of a grid?

I have the code that adds rows to a grid working (which I will share later).

So how would I delete a row from a grid called myGrid?

Tiggr("myGrid tr:eq(1)").remove(); // this would delete the second row of the table

ref: http://stackoverflow.com/questions/58...

Jason Cochran
Posts: 0
Joined: Thu Aug 16, 2012 2:46 am

How to programatically add/delete rows of a grid?

I have the code that adds rows to a grid working (which I will share later).

So how would I delete a row from a grid called myGrid?

the following does not work for me:

Code: Select all

  Tiggr("myGrid tr:eq(1)").remove(); 

ref: http://stackoverflow.com/questions/58...

Return to “Issues”