- 注册时间
- 2021-9-26
- 最后登录
- 2022-2-22
- 阅读权限
- 10
- 积分
- 115
- 精华
- 0
- 帖子
- 21
|
felt 发表于 2021-10-15 10:23
不是一个页面的控件,怎么能直接去获取
请跨页面去获取。
怎么跨?
A页面- + '<a class="Edit_Button" href="javascript:editRow(\'' + uid + '\')">修改</a>'
- function editRow(id)
- {
- var row = grid.getSelected();
- //console.log("usernumber"+row.usernumber);
- if (row) {
- mini.open({
- targetWindow: window,
- //url: bootPATH + "../../user/edit",
- url: bootPATH + "../../user/edituser?id="+row.id,
- title: "修改用户", width: 600, height: 400,
- onload: function () {
- var iframe = this.getIFrameEl();
- var data = { action: "user/edit", id: row.id };
- iframe.contentWindow.SetData(data);
- },
- ondestroy: function (action) {
- grid.reload();
- }
- });
- }
- }
复制代码 弹窗的页面html同上诉js代码如下- <script type="text/javascript">
- mini.parse();
- var form = new mini.Form("form1");
- var grid = mini.get("form1");
- grid.load();
- function SaveData() {
- // console.log("department:"+department);
- var getdepartment = mini.get("department");
- var key = mini.get("department").getValue();
- console.log("key"+key);
- console.log("getdepartment"+getdepartment);
- saveForm(form, {
- // url: "../data/AjaxService.aspx?method=SaveEmployees",
- // url:"../node/edit",
- url:"../user/Save",
- data: {department:getdepartment},
- // data: {department:department},
- callback: function (success) {
- if (success) CloseWindow("save");
- else CloseWindow();
- }
- });
- }
- function onOk(e) {
- SaveData();
- }
- function onCancel(e) {
- CloseWindow("cancel");
- }
- //标准方法接口定义
- function SetData(data) {
- if (data.action == "user/edit") {
- //跨页面传递的数据对象,克隆后才可以安全使用
- // data = mini.clone(data);
- // console.log("userdata.id"+data.usernumber);
- $.ajax({
- url: "../user/edit?id=" + data.id,
- cache: false,
- success: function (text) {
- var o = mini.decode(text);
- form.setData(o);
- form.setChanged(false);
- onDeptChanged();
- mini.getbyName("position").setValue(o.position);
- }
- });
- }
- }
- function GetData() {
- var o = form.getData();
- return o;
- }
- function CloseWindow(action) {
- if (action == "close" && form.isChanged()) {
- if (confirm("数据被修改了,是否先保存?")) {
- return false;
- }
- }
- if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
- else window.close();
- }
- </script>
复制代码 |
|