This kind of demand seems to feel not very reasonable, because the data is so much the pull from the human or machine operations are more painful.
No way because of the demand down, can only operate as required. On the internet to find a lot of related controls are feeling a bit large, accounting for more resources. No way to spend half a day to make a custom control of semi-finished products, take out share, such as a master see please more guidance.
Requirements: Ajax scrolling scroll bar loading data drop-down list
Control Name: Webcombo
Technology used: asp.net (C #), jquery,asp. NET General processing file (. ashx)
Drop-down list specific implementation: Using DIV simulation drop-down list, input and picture simulation Drop-down box. The final results are shown below
Let's analyze the plugin on the jquery side.
Ajax loaded with jquery Ajax complete
Copy Code code as follows:
$.ajax ({
Type:options.getMethod,
URL:OPTIONS.JSONURL,
Data:params,
Success:function (data) {
if (Isscroll)
$. Createlistitem (showbox,data,options);
Else
$. Createbox (showbox,data,options);
},
Complete:function () {},
Error:function (e) {
$ (options.loadbox). CSS (' background-image ', ' none ');
$ (Options.loadbox). Append (' <span>data connect error! ' +e+ ' </span> ');
}
The scroll bar scrolling load data is completed by the Onscroll event of the dropdown Div, the core code is as follows:
Copy Code code as follows:
$ (Showbox). Scroll (function () {
if (options.total==$ (this). Children ("ul"). Children ("Li"). Length)
Return
var scrolltop=$ (Showbox). attr (' scrolltop ');
var scrollheight=$ (Showbox). attr (' scrollheight ');
var windowheight=$ (Showbox). attr (' clientheight ');
var scrolloffset=20;
$ (options.loadbox). CSS (' top ', scrolltop);
if (scrolltop>= (scrollheight-(windowheight+scrolloffset)) &&!loading)
{
Loading=true;
$ (Options.loadbox). Show ();
options.total=$ (This). Children ("ul"). Children ("Li"). length;
$. Webcombogetdata (showbox,options,true);
}
});
The plugin's complete code can be found in the source file, file name: simulateddl.js
In fact, this scroll bar scrolling data to load the jquery plug-in has been written to achieve this functionality, just because the project used in the place more and more rogue to encapsulate it into the ASP.net custom control. The reason why the semi-finished is this custom control customization of some of the humanization, the experts see the guidance. Specific code can be downloaded after viewing, I am not a control production master, will not move out of the shortcoming. The friend who has the question suggestion may propose to discuss the discussion.
Asp.net+jquery scroll bar scrolling load Data Control source code download