jQuery實現GridView列表自定義顯示列

2021-06-06 11:49:37 字數 687 閱讀 2768

乙個系統中有時候會為了方便使用者操作,由使用者決定顯示列表中的哪些資料,示例如下:

下面我們看下用jquery如何實現,有哪些注意點。

抽出來的公用的jquery**如下:

$(document).ready(function() )

$("input[belong='btnreset']").click(function() )

})//遍歷checkboxlist根據選中值控制列的顯示

function ergodiccbl()

else

})}//找出列名在列表中的列索引

function findindex(column)

i++;

})return index;

}//隱藏索引列

function hidecolumn(index) )

}//顯示索引列

function showcolumn(index) )

}

實際頁面**如下:

其中,checkboxlist控制項不能使用伺服器控制項,要用html編寫,自定義兩個屬性用於標識checkbox和確定按鈕即可。

取消Gridvie中button的焦點

gridview中新增button,onclick方法使得 gridview的setonitemclicklistener方法無效。解決方法 設定button的xml布局檔案,也就是自定義的adapter中getview方法的 convertview的布局檔案 將button屬性分別設定為 andr...

jQuery實現拖動

定位 給要拖動的物件設定乙個定位 position aboselute 座標 使用event.clientx event.clienty獲取滑鼠位置,使用obj.offset left obj.offset top獲取物件離瀏覽器左上角的座標 事件 mousedown,mouseup,mousemo...

簡單實現jQuery

jquery的本質是函式,下面來簡單實現一下jquery中的addclass和text window.jquery function if typeof nodeorselector string else if nodeorselector instanceof node else if node...