zoukankan      html  css  js  c++  java
  • 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:'',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="100px;height:100px;">  
        <div id="title" style="background:#ccc;">title</div>  
    </div> 

    Create a draggable element using javascript.

        <div id="dd" style="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;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.
  • 相关阅读:
    一些总结与思考(聊聊最近,希望对大家有所帮助)
    操作符、语句、函数——Javascript高级程序设计
    Javascript高级程序设计——语法、关键字、保留字、变量、数据类型
    Javascript高级程序设计——Javascript简史+使用Javascript
    Angular.js!(附:聊聊非原生框架项目)
    JS事件绑定深入
    Javascript事件绑定及深入
    实现API管理系统的几个重要关键词
    实现API优先设计的重要性和实现方式
    对API进行版本控制的重要性和实现方式
  • 原文地址:https://www.cnblogs.com/ly7454/p/2664499.html
Copyright © 2011-2022 走看看