随笔分类 - JQuery
摘要:SlickGrid简单介绍 : https://github.com/mleibman/SlickGrid/wiki 快速入门 : https://github.com/mleibman/SlickGrid/wiki/Getting-Started 使用示例 : https://github.com
阅读全文
摘要:本文会给你们展示50个jquery代码片段,这些代码能够给你的javascript项目提供帮助。其中的一些代码段是从jQuery1.4.2才开始支持的做法,另一些则是真正有用的函数或方法,他们能够帮助你又快又好地把事情完成。如果你发现你任何可以做得更好的地方的话,欢迎把你的版本粘贴在评论中!1. 如何修改jQuery默认编码(例如默认UTF-8改成改GB2312):$.ajaxSetup({ ajaxSettings:{ contentType:"application/x-www-form-urlencoded;chartset=GB2312"} });2. 解决jQue
阅读全文
摘要:JQuery获取和设置Select选项方法汇总如下:获取select先看看下面代码:$("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发var checkText=$("#select_id").find("option:selected").text(); //获取Select选择的Textvar checkValue=$("#select_id").val(); //获取Select选择的Valuevar checkInd
阅读全文
摘要:Writing custom cell editorsPage HistoryBasic interfacefunction IEditor(args) { // initialize the UI /*********** REQUIRED METHODS ***********/ this.destroy = function() { // remove all data, events & dom elements created in the constructor }; this.focus = function() { //...
阅读全文
摘要:Providing data to the gridPage HistoryOverviewThe data is passed to the grid via the constructor and can also be accessed using thesetData(data)andgetData()methods. Data itself can be either an array-like object with alengthproperty and an indexer (data[index]) or a custom data provider implementing
阅读全文
摘要:Grid OptionsPage HistoryAs included in the examples or described in stable releases.Booleans:autoEditCell will not automatically go into edit mode when selected.autoHeighteditableenableAddRowIf true, a blank row will be displayed at the bottom - typing values in that row will add a new one.enableAsy
阅读全文
摘要:SlickGrid exposes the following events:onScrollonSortonHeaderContextMenuonHeaderClickonMouseEnteronMouseLeaveonClickonDblClickonContextMenuonKeyDownonAddNewRowonValidationErroronViewportChangedonColumnsReorderedonColumnsResizedonCellChangeonBeforeEditCellonBeforeCellEditorDestroyonBeforeDestroyonAct
阅读全文
摘要:Model API:Instead of passing SlickGrid an array of row objects, you can pass an object that holds (and updates!) all your rows. This object, which SlickGrid calls aModel, only needs to respond to a simple API:model.getItem(i) // Returns the ith rowmodel.getLength() // Returns the number of itemsRow
阅读全文
摘要:Although the source of thefirst exampleis self-explanatory, it's worth to point out the basics of SlickGrid. The following line:var slickgrid = new Slick.Grid("#node", rows, columns, options);initializes -but doesn't display- SlickGrid, asigning its interface to theslickgridvar. No
阅读全文
摘要:jQuery中的extend() extend()函数是jQuery的基础函数之一,作用是扩展现有的对象。例如下面的代码:Html代码<scripttype="text/javascript"src="jquery-1.5.2.js"></script><script>obj1={a:'a',b:'b'};obj2={x:{xxx:'xxx',yyy:'yyy'},y:'y'};$.extend(true,obj1,obj2);alert(
阅读全文
摘要:一,什么是jqueryjQuery是继prototype之后又一个优秀的Javascrīpt框架。其宗旨是——WRITE LESS,DO MORE,写更少的代码,做更多的事情。说白了,jquery就是javascript。只不过按照人的习惯思维把它封装了一个比较强大的框架。还有一点jquery能够把html和javascript尽量分离,这也是我愿意用jquery的一个重要原因。jqueryt很灵活,太灵活了,可以说是他一个优点,也是他一个缺点,达到一种效果,十个人也许会用十种不同的方法来实现这个过程,结果一样,过程不一样,这到底是好,还是坏呢。就各说各的理了。二,学习和使用jquery的困惑
阅读全文
摘要:JQuery的extend扩展方法: Jquery的扩展方法extend是我们在写插件的过程中常用的方法,该方法有一些重载原型,在此,我们一起去了解了解。一、Jquery的扩展方法原型是: extend(dest,src1,src2,src3...); 它的含义是将src1,src2,src3...合并到dest中,返回值为合并后的dest,由此可以看出该方法合并后,是修改了dest的结构的。如果想要得到合并的结果却又不想修改dest的结构,可以如下使用: var newSrc=$.extend({},src1,src2,src3...)//也就是将"{}"作为dest参数
阅读全文
摘要:这些代码能够给你的javascript项目提供帮助。其中的一些代码段是从jQuery1.4.2才开始支持的做法,另一些则是真正有用的函数或方法,他们能够帮助你又快又好地把事情完成。1. 如何创建嵌套的过滤器://允许你减少集合中的匹配元素的过滤器,//只剩下那些与给定的选择器匹配的部分。在这种情况下,//查询删除了任何没(:not)有(:has)//包含class为“selected”(.selected)的子节点。.filter(":not(:has(.selected))")2. 如何重用元素搜索var allItems = $("div.item"
阅读全文