如何使用onClickTopics struts2 jquery插件发送textfield的值

时间:2010-08-08 09:53:43

标签: java jquery plugins struts2

我想在一个按钮的onClickTopics上发送我的文本字段值。这个按钮将从Jquery网格重新加载数据,但在重新加载struts bean之前需要比较textfield中的几个值。

这是我的按钮标记:

<sj:a button="true" onClickTopics="submitSuccess" indicator="indicator" targets="result">Tampilkan</sj:a>

这是我的文字字段:

<sj:textfield id="namaDistributor" name="namaDistributor" label="Nama Distributor"/>

当onclick时,它会重新加载网格,但是如何从下面的脚本中将namaDistributor值传递给backbean。

$.subscribe('submitSuccess', function(event,element) {
 alert(element);
 $("#gridtable").trigger("reloadGrid");
});

编辑: 我尝试了另一种替代方法来传递GridTable的新值,但它也没有显示可更新的值。

当我点击网格时,它将转到网格操作,数据从表单传递:

$('#search').click(function(){
    // Make the ajax request
        $.ajax({
            data : "idDistributor=JKT005",
            url: 'DataPenjualanPerDistributor.find.action',
            dataType: "json",
            success: function(data) {
                alert('Grid :'+data.gridtable);
                // Set the input value from the returned string            
                $('#gridtable').val(data.gridtable);
            }
        });
});

非常感谢

Mr.K

0 个答案:

没有答案