John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

How to duplicate an item while in the same screen?

Hi, I have a few labels in a gridview (for example) that I would like to have the user be able to add as many of those gridviews as they want (basically the user to create a self list, but not necessarilly in a list view). I'm imagining that I would have to write JS for this. If so, what would the JS look like? Or is there another easier way to do this?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How to duplicate an item while in the same screen?

Hello! Working on it.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How to duplicate an item while in the same screen?

Hi John,

You should programmatically create new items to get a needed structure. This can be based on template, for example:
precodevar row = ['<tr>',
'<td>',
' <div class="cell-wrapper">',
' <div data-role="appery_label">',
' Label',
' <&#47;div>',
' <&#47;div>',
'<&#47;td>',
'<td>',
' <div class="cell-wrapper">',
' <div data-role="appery_label">',
' Label',
' <&#47;div>',
' <&#47;div>',
'<&#47;td>',
'<&#47;tr>']&#46;join("");

$( row )&#46;appendTo( Appery("your_mobilegrid_component_name")&#46;find("tbody") )&#46;trigger( "create" );/code/pre

Note the absence of CSS-classes for the row and table cells. This may cause a discrepancy in appearance. Add the needed CSS-classes for the rows, cells, and built-in components.

. trigger ("create") - is needed to initialize jQueryMobile components used within the created cells.

Return to “Issues”