码迷,mamicode.com
首页 > 其他好文 > 详细

JEasyUI: Bug Fixing for perpertygrid

时间:2016-03-08 13:25:09      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:

The propertygrid is really a nice plugin. However, you may encounter error if load it with ajax method as below.

$(‘#p_prop‘).panel(‘refresh‘, ‘./property_data.php‘);	

When editing a loaded property field, user abort the action by refreshing the property panel again. You will get below error:

技术分享

Reason:

Inside stopEditing which is called during propertygrid initialization, the opts line failed, due to currTarget is global variable which is not reset when reloading by ajax

function stopEditing(target){
		var t = $(target);
		if (!t.length){return}
		var opts = $.data(target, ‘propertygrid‘).options;
		opts.finder.getTr(target, null, ‘editing‘).each(function(){
			var index = parseInt($(this).attr(‘datagrid-row-index‘));
			if (t.datagrid(‘validateRow‘, index)){
				t.datagrid(‘endEdit‘, index);
			} else {
				t.datagrid(‘cancelEdit‘, index);
			}
		});
		opts.editIndex = undefined;
	}

  

 Solution:

function buildGrid(target){
		var state = $.data(target, ‘propertygrid‘);
		var opts = $.data(target, ‘propertygrid‘).options;
		currTarget = undefined; //bug fixing for ajax reload

  

JEasyUI: Bug Fixing for perpertygrid

标签:

原文地址:http://www.cnblogs.com/binglong/p/5253600.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!