[Seasar-user:17822] [Teeda *****Items]について

thomas [E-MAIL ADDRESS DELETED]
2009年 6月 22日 (月) 20:31:25 JST


Hai,

Itried to add some rows to the ****Items
like   http://ml.seasar.org/archives/seasar-user/2008-December/016543.html


addrow.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:te="
http://www.seasar.org/teeda/extension" lang="ja" xml:lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<script type="text/javascript" src="../../js/jquery.js"></script>
<script type="text/javascript">
function addRow() {
var rowStr = '<tr>';
rowStr += '<td><span id="rowno"></span></td>';
rowStr += '<td><input id="userId" type="text" /></td>';
rowStr += '<td><input type="hidden" id="rowno-1" /></td>';
rowStr += '</tr>';
$('#userItems').append(rowStr);
 // 明細のINDEXを振り直す
resetIndex();
}

// 明細のINDEXを振り直す
function resetIndex(){
var nameVal = 'includeChildBody:form:userItems:';
$('#userItems tr').each(function(idx, obj){
// 行番号を振り直す
$(obj).find('#rowno').text('' + (idx + 1));
// name属性のindexを振りなおす
$(obj).find('#rowno').attr('name', nameVal + idx + ':rowno');
$(obj).find('#userId').attr('name', nameVal + idx + ':userId');
$(obj).find('#rowno-1').attr('name', nameVal + idx + ':rowno-1');
});
}
</script>
</head>
<body>
<span id="allMessages"/>
<form id="form">
<table>
<thead>
<th>ユーザID</th>
</thead>
<tbody id="userItems">
<tr>
<td><span id="rowno"></span></td>
<td><input id="userId" type="text" value="" /></td>
<input type="hidden" id="rowno-1"/>
</tr>
</tbody>
</table>
<input type="button" onclick="addRow()" value="ADD ROW"/>
<input type="button" id="doTest" value="TEST"/>
</form>
</body>
</html>


AddrowPage.java

package testproject.web.test;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.seasar.teeda.extension.annotation.scope.SubapplicationScope;
import testproject.dto.UserDto;

public class AddrowPage {

    public List<UserDto> userItems;
    public int userIndex;
    public String rowno;
    public String userId;
//    public Class getLayout() {
//    return null;
//    }

    public Class doTest() {
        System.out.println("doTest  size=" + userItems.size());
        return null;
    }

    public Class initialize() {
        Date today = new Date();
        userItems = new ArrayList<UserDto>();
        UserDto user1 = new UserDto();
        user1.timesp = new Timestamp(today.getTime());
        user1.rowno = "1";
        user1.userId = "A001";
        user1.userName = "USER A";
        userItems.add(user1);
        UserDto user2 = new UserDto();
        user2.timesp = new Timestamp(today.getTime());
        user2.rowno = "2";
        user2.userId = "B001";
        user2.userName = "USER B";
        userItems.add(user2);
        return null;
    }

    public Class prerender() {
        return null;
    }
}

When i click the ADDROW button i can create row in javascript,after clicking
the TEST button,i checked the size of the Items,
Its only 2..How can i get the size including the rows created in javascrip?


Please give me some solution to solve this problem.

Thanks in advance,
トマス
-------------- next part --------------
HTMLの添付ファイルを保管しました...
URL: <http://ml.seasar.org/archives/seasar-user/attachments/20090622/15cd9e51/attachment.html>


Seasar-user メーリングリストの案内