Draggable

1.<div id="tb" style="padding:3px">  
2.    <span>Item ID:</span>  
3.    <input id="itemid" style="line-height:26px;border:1px solid #ccc">  
4.    <span>Product ID:</span>  
5.    <input id="productid" style="line-height:26px;border:1px solid #ccc">  
6.    <a href="#" class="easyui-linkbutton" plain="true" onclick="doSearch()">Search</a>  
7.</div>  

 When user enters search values and press search button, the 'doSearch' function will be called:

1.function doSearch(){   
2.    $('#tt').datagrid('load',{   
3.        itemid: $('#itemid').val(),   
4.        productid: $('#productid').val()   
5.    });   
6.}

 把checkbox换成radio:

singleSelect:true,
columns:[[
       {field:'radio',title:'',width:30,
                        formatter: function(value,row,index){
                        return '<input type="radio" name="rd" />';
       }}					  

 

onClickRow:function(rowIndex, rowData){
                    $("input[type=radio]",$("div.datagrid-view2 tr.datagrid-row-selected")).attr("checked","checked");
                }

 

Draggable

Override defaults with $.fn.draggable.defaults.

Usage Example

Create a draggable element from markup.

<div id="dd" class="easyui-draggable" data-options="handle:'#title'" style="width:100px;height:100px;">  
    <div id="title" style="background:#ccc;">title</div>  
</div> 

Create a draggable element using javascript.

    <div id="dd" style="width:100px;height:100px;">  
        <div id="title" style="background:#ccc;">title</div>  
    </div>  
$('#dd').draggable({  
    handle:'#title'  
});

Properties

NameTypeDescriptionDefault
proxy string,function A proxy element to be used when dragging, when set to 'clone', a clone element is used as proxy. If a function is specified, it must return a jQuery object.

The example below shows how to create a simple proxy object.

$('.dragitem').draggable({
	proxy: function(source){
		var p = $('<div style="border:1px solid #ccc;width:80px"></div>');
		p.html($(source).html()).appendTo('body');
		return p;
	}
});
null
revert boolean If set to true, the element will return to its start position when dragging stops. false
cursor string The css cursor when dragging. move
deltaX number The dragged element position x corresponding to current cursor null
deltaY number The dragged element position y corresponding to current cursor null
handle selector The handle that start the draggable. null
disabled boolean True to stop draggable. false
edge number The drag width in which can start draggable. 0
axis string Defines the axis which the dragged elements moves on, available value is 'v' or 'h', when set to null will move across 'v' and 'h' direction. null

Events

NameParametersDescription
onBeforeDrag e Fires before dragging, return false to cancel this dragging.
onStartDrag e Fires when the target object start dragging.
onDrag e Fires during dragging. Return false will not do dragging actually.
onStopDrag e Fires when the dragging stops.

Methods

NameParameterDescription
options none Return the options property.
proxy none Return the drag proxy if the proxy property is setted.
enable none Enable the drag action.
disable none Disable the drag action.
posted @ 2012-08-30 21:27  英雄饶命啊  阅读(307)  评论(0编辑  收藏  举报