小编Fai*_*yet的帖子

jqgrid - 关闭表单对话框

我正在使用jqgrid 4.3.1,我正在使用本地数据进行表单编辑.问题是添加或编辑后表单没有关闭.这是我的代码.

                  $('#studentset').jqGrid({
                      data: mydata,
                      datatype: "local",
                      colNames:['id','First Name', 'Last Name'], 
                      colModel:[ 
                                   {name:'id',index:'id', width:60}, 
                                   {name:'firstName',index:'fName', width:300, editable:true},
                                   {name:'lastName',index:'lastName', width:300, editable:true}
                      ],
                      pager: '#pager',
                      rowNum: 10,
                      rowList: [5, 10, 20],
                      sortname: 'id',
                      sortorder: 'asc',
                      viewrecords: true,
                      height: "80%",
                      caption: "Students to be Registered",
                      editurl: corpUrl
                  });
                  $('#studentset').jqGrid('navGrid', '#pager', { add: true, edit: true, del: false, search: false, refresh: false },
                            {
                                recreateForm: true,
                                closeAfterEdit: true,
                                modal:true,
                                afterSubmit: function(data){
                                    var myObject = eval('(' + data.responseText + ')');
                                    $('#studentset').setGridParam({data: myObject}).trigger("reloadGrid");
                                }
                            },
                            { …
Run Code Online (Sandbox Code Playgroud)

jquery jqgrid

3
推荐指数
1
解决办法
1万
查看次数

更改密码 - Spring Security

我有一个 Spring MVC 3.0 应用程序,并实现了 Spring Security。我正在创建一个小弹出窗口来更改当前登录用户的密码。一切都很好,直到我将表格发布到以下操作。

\n\n
@RequestMapping(value = "principalchangepassword" , method = RequestMethod.POST)\npublic @ResponseBody String principalchangepassword(Model uiModel, HttpServletRequest httpServletRequest){\n    Principal principal = (Principal) SecurityContextHolder.getContext().getAuthentication().getPrincipal();\n    StandardStringDigester digester = new StandardStringDigester();\n    digester.setAlgorithm("SHA-256");   // optionally set the algorithm\n    digester.setStringOutputType("hexadecimal");\n    digester.setSaltSizeBytes(0);\n    digester.setIterations(1);\n    String digest = digester.digest(httpServletRequest.getParameter("password1")); \n    principal.setPassword(digest.toLowerCase());\n    principal.merge();\n    return "Password Updated successfully";\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

当我执行 ajax 调用来更新当前主体的密码时,我收到以下异常消息。

\n\n
org.hibernate.TransientObjectException: object references an unsaved transient instance \xe2\x80\x93 save the transient instance before flushing\n
Run Code Online (Sandbox Code Playgroud)\n\n

我究竟做错了什么 ?

\n

spring spring-mvc spring-security

3
推荐指数
1
解决办法
2万
查看次数

如何从客户端JavaScript代码访问Java列表元素?

我有以下简单的脚本,我用它来动态创建一个列表元素 <ul>

<script type="text/javascript">
    function generate(){
        var arr = new Array();
        <c:forEach items="${articles}" var="a" varStatus="status">
            $('#listitems').append(
                "<li>"+${a.title}+"</li>"
            );
            arr[${status.index}] ="${a.slideShow.images}";
        </c:forEach>
    }
</script> 
Run Code Online (Sandbox Code Playgroud)

我的问题源于images属性.每篇文章都有幻灯片,每个幻灯片都有一个图像列表.我想通过jave list.get(index)从图像列表中取出第一个图像; 我想做一些像"$ {a.slideShow.images.get(0)}"这样的事情..get()是列表对象中的java方法.

有任何想法吗?

javascript java jsp el

2
推荐指数
1
解决办法
6864
查看次数

设置选择值

嘿所有,有没有办法设置一个选择的值,并让它像用户改变它一样?我用了

$(document).ready(function(){
    $('#department').change(function(){
        $('#academicbody').hide();
        var selected = $("#department :selected").val();
        $('#progrmmehome').load('/email/programmelist/'+selected);
    });
    $('#university').change(function(){
        var selected = $("#university :selected").val();
        $('#department').val(selected);
        $('#progrmmehome').load('/email/programmelist/'+selected);
    });
});
Run Code Online (Sandbox Code Playgroud)

基本上,当选择大学时,它的值是部门ID,然后在网址中使用.因此,在名为"大学"的选择的更改事件中,我希望通过设置部门选择的值,将执行部门的更改事件中的逻辑.

有任何想法吗?

html javascript forms jquery

1
推荐指数
1
解决办法
180
查看次数

Kohana 3形式选择验证

干草全部,我正在尝试验证kohana 3.0中的选择,我正在使用必要的规则.但是,当用户没有做出选择时,验证不会"启动".

<select id="discipline" name="discipline" >
<option value="0"> -- Select One -- </option>
<option value="-2">Information Technology and Engineering</option>
<option value="4">Business and Training Seminars</option>
</select>
Run Code Online (Sandbox Code Playgroud)

这是我的选择,现在我已经在检查验证错误之前将这些规则应用于post数组.

$post = Validate::factory($_POST)
                ->rule('discipline', 'not_empty')
                ->rule('discipline', 'numeric');
Run Code Online (Sandbox Code Playgroud)

当我在没有做出选择的情况下提交表单时,表单提交并且规则应该停止.

有任何想法吗 ?

kohana

0
推荐指数
1
解决办法
1634
查看次数

Jquery从$(this)中查找子元素

我有一个表,其中每行包含一个表单.见下文

<table>
<tr><th>Fee Type</th><th>Amount</th><th>% Discount</th><th>Discounted Amount</th><th>Payable to</th><th>Remove</th></tr>    
<tr>
   <form>
         <td></td>
         <td class="cost"></td>
         <td> <input /> </td>
         <td class="discount"></td>
         <td></td>
   </form>
<tr>
</table>
Run Code Online (Sandbox Code Playgroud)

现在我的目的是拥有一个全局保存按钮,它将遍历每个表单并执行ajax帖子.见下文

    function saveEditedFees(){
        $("#savefeechanges").click(function(){
            $("#feestable form").each(function(){
                alert( $(this).attr('id') );
            });
        });
    }
Run Code Online (Sandbox Code Playgroud)

我的问题是使用$(本)使用类的元素访问值,为"TD" "成本""打折" 我试着

alert( $(this).find("td").eq(2).html() );
alert($(this).siblings('.cost').text());
alert($("td .cost" ,this).text());
Run Code Online (Sandbox Code Playgroud)

基本上,我试图测试其中包含的值<td class="cost">是否等于<td class="discount">,这样我将有选择地做一个ajax帖子.

请帮忙.

jquery jquery-selectors this-keyword

0
推荐指数
1
解决办法
7586
查看次数