string sql = string.Format(" select id,author,content,convert(varchar(100), createOn, 120) createOn from ( select row_number () over (order by id) as rowNum,* from test) as t "
System.Data.DataTable dt = db.ExecuteDataSet(System.Data.CommandType.Text,sql).Tables[0];
(function( $ ){
var target = null;
var template = null;
var lock = false;
var 변수 = {
'last' : 0
}
var settings = {
'amount' : '10',
'address' : '',
'format' : 'json',
'템플릿' : '.single_item',
'트리거' : '.get_more',
'스크롤' : 'false',
'오프셋' : '100',
' spinner_code': ''
}
var 메소드 = {
init : function(options){
return this.each(function(){
if(options) ){
$.extend(settings, options);
}
template = $(this).children(settings.template).wrap('
').parent() ;
template.css('display','none')
$(this).append('
' settings.spinner_code '
')
$(this).children(settings.template).remove()
target = $(this)
if(settings.scroll == 'false'){
$(this). find(settings.trigger).bind('click.more',methods.get_data);
$(this).more('get_data')
}
else{
if($ (this).height() <= $(this).attr('scrollHeight')){
target.more('get_data',settings.amount*2);
}
$(this).bind('scroll.more',methods.check_scroll);
}
})
},
check_scroll : function(){
if((target.scrollTop() target.height() parseInt(settings.offset)) >= target .attr('scrollHeight') && lock == false){
target.more('get_data');
}
},
debug : function(){
var debug_string = '';
$.each(변수, 함수(k,v){
debug_string = k ' : ' v 'n';
})
alert(debug_string);
},
remove : function(){
target.children(settings.trigger).unbind('.more');
target.unbind('.more')
target.children(settings.trigger).remove();
},
add_elements : function(data){
//alert('요소 추가')
var root = target
// Alert(root.attr('id) '))
var counter = 0;
if(data){
$(data).each(function(){
counter
var t = template
$.each(this, function(key, value){
if(t.find('.' key)) t.find('.' key).text(value)
})
//t.attr('id', 'more_element_' (variables.last ))
if(settings.scroll == 'true'){
// root.append(t.html())
root.children('.more_loader_spinner').before (t.html())
}else{
// Alert('...')
root.children(settings.trigger).before(t.html())
}
root.children(settings.template ':last').attr('id', 'more_element_' ((variables.last ) 1))
} )
}
elsemethods.remove()
target.children('.more_loader_spinner').css('display','none');
if(counter < settings.amount)methods.remove()
},
get_data : function(){
// Alert('데이터 가져오기')
var ile;
잠금 = true;
target.children(".more_loader_spinner").css('display','block');
$(settings.trigger).css('display','none');
if(typeof(arguments[0]) == '숫자') ile=arguments[0];
else {
ile = settings.amount;
}
$.post(settings.address, {
last : Variable.last,
amount : ile
}, function(data){
$(settings .trigger).css('display','block')
methods.add_elements(data)
lock = false;
}, settings.format)
}
} ;
$.fn.more = 함수(메서드){
if(메서드[메서드])
반환 메서드[ 메서드 ].apply( this, Array.prototype.slice.call( 인수, 1 )) ;
else if(typeof method == 'object' || !method)
returnmethods.init.apply(this, 인수);
else $.error('메소드 '메서드'가 존재하지 않습니다!');
}
})(jQuery)