如何在jquery mRender中插入spring-form标记

How to insert spring form tag in jquery mRender

本文关键字:插入 spring-form 标记 mRender jquery      更新时间:2023-09-26

我有一个Spring表单中的表,第一列是表中每行的复选框。我想插入springform:复选框,但变量不替换为值。我举了一个例子:

"aoColumns" : [ {
                            "mRender": function ( data, type, full ) {
                                if(full.eStatus!="REMOVED"){
                                    var identifier=full.identifier;
                                return '<form:checkbox path="userIdsToDelete" value="' + identifier + '" onchange="toggleCheckbox()"/>';
                                }
                                    return '';
                                }}, {
                            "mDataProp" : "firstName"
                        }, {
                            "mDataProp" : "lastName"
                        }, {
                            "mDataProp" : "email"
                        }, {
                            "mDataProp" : "staffNumber"
                        }, {
                            "mDataProp" : "enrollementTypeName" ,  "bVisible" : '${!enrollmentTypePage}'
                        }, {
                            "mDataProp" : "organizationTitle",  "bVisible" : '${allView}' 
                        }, {
                            "mDataProp" : "status"
                        } ]

当我检查checkBox元素时:<input id="userIdsToDelete1" name="userIdsToDelete" onchange="toggleCheckbox()" type="checkbox" value="' + identifier + '">

然而,当我在"mRender"中放入一个没有spring-form标记的html输入时,它很好地替换了我的标识符Variable。

我在不使用spring标记表单的情况下添加了输入html,从而解决了这个问题。

"aoColumns" : [ {
                            "mRender": function ( data, type, full ) {
                                if(full.eStatus!="REMOVED"){
                                    var identifier=full.identifier;
                                    var checkBox='<input name="userIdsToDelete" onchange="toggleCheckbox()" type="checkbox" value="'+identifier+'">'+
                                       '<input type="hidden" name="_userIdsToDelete" value="on">';
                                return checkBox ;

                                }
                              return '';
                                }}, {
                            "mDataProp" : "firstName"
                        }, {
                            "mDataProp" : "lastName"
                        }, {
                            "mDataProp" : "email"
                        }, {
                            "mDataProp" : "staffNumber"
                        }, {
                            "mDataProp" : "enrollementTypeName" ,  "bVisible" : '${!enrollmentTypePage}'
                        }, {
                            "mDataProp" : "organizationTitle",  "bVisible" : '${allView}' 
                        }, {
                            "mDataProp" : "status"
                        } ]