⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htmltablestore.js

📁 这是一个ajax的例子大家好好的看看就是一个鱼眼的效果
💻 JS
📖 第 1 页 / 共 2 页
字号:
if(!dojo._hasResource["dojox.data.tests.stores.HtmlTableStore"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dojox.data.tests.stores.HtmlTableStore"] = true;dojo.provide("dojox.data.tests.stores.HtmlTableStore");dojo.require("dojox.data.HtmlTableStore");dojo.require("dojo.data.api.Read");dojo.require("dojo.data.api.Identity");dojox.data.tests.stores.HtmlTableStore.getBooks2Store = function(){	return new dojox.data.HtmlTableStore({url: dojo.moduleUrl("dojox.data.tests", "stores/books2.html").toString(), tableId: "books2"});};dojox.data.tests.stores.HtmlTableStore.getBooksStore = function(){	return new dojox.data.HtmlTableStore({url: dojo.moduleUrl("dojox.data.tests", "stores/books.html").toString(), tableId: "books"});};doh.register("dojox.data.tests.stores.HtmlTableStore", 	[/***************************************     dojo.data.api.Read API***************************************/		function testReadAPI_fetch_all(t){			//	summary: 			//		Simple test of fetching all xml items through an XML element called isbn			//	description:			//		Simple test of fetching all xml items through an XML element called isbn			var store = dojox.data.tests.stores.HtmlTableStore.getBooksStore();			var d = new doh.Deferred();			function onComplete(items, request) {				t.assertEqual(20, items.length);				d.callback(true);			}			function onError(error, request) {				d.errback(error);			}			store.fetch({query:{isbn:"*"}, onComplete: onComplete, onError: onError});			return d; //Object		},		function testReadAPI_fetch_one(t){			//	summary: 			//		Simple test of fetching one xml items through an XML element called isbn			//	description:			//		Simple test of fetching one xml items through an XML element called isbn			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();			var d = new doh.Deferred();			function onComplete(items, request) {				t.assertEqual(1, items.length);				d.callback(true);			}			function onError(error, request) {				d.errback(error);			}			store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});			return d; //Object		},		function testReadAPI_fetch_paging(t){			//	summary: 			//		Simple test of fetching one xml items through an XML element called isbn			//	description:			//		Simple test of fetching one xml items through an XML element called isbn			var store = dojox.data.tests.stores.HtmlTableStore.getBooksStore();						var d = new doh.Deferred();			function dumpFirstFetch(items, request){				t.assertEqual(5, items.length);				request.start = 3;				request.count = 1;				request.onComplete = dumpSecondFetch;				store.fetch(request);			}			function dumpSecondFetch(items, request){				t.assertEqual(1, items.length);				request.start = 0;				request.count = 5;				request.onComplete = dumpThirdFetch;				store.fetch(request);			}			function dumpThirdFetch(items, request){				t.assertEqual(5, items.length);				request.start = 2;				request.count = 20;				request.onComplete = dumpFourthFetch;				store.fetch(request);			}			function dumpFourthFetch(items, request){				t.assertEqual(18, items.length);				request.start = 9;				request.count = 100;				request.onComplete = dumpFifthFetch;				store.fetch(request);			}			function dumpFifthFetch(items, request){				t.assertEqual(11, items.length);				request.start = 2;				request.count = 20;				request.onComplete = dumpSixthFetch;				store.fetch(request);			}			function dumpSixthFetch(items, request){				t.assertEqual(18, items.length);				d.callback(true);			}			function completed(items, request){				t.assertEqual(20, items.length);				request.start = 1;				request.count = 5;				request.onComplete = dumpFirstFetch;				store.fetch(request);			}			function error(errData, request){				d.errback(errData);			}			store.fetch({onComplete: completed, onError: error});			return d; //Object		},		function testReadAPI_fetch_pattern0(t){			//	summary: 			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match			//	description:			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();			var d = new doh.Deferred();                                                             			function onComplete(items, request) {				t.assertEqual(1, items.length);				d.callback(true);			}			function onError(error, request) {				d.errback(error);			}			store.fetch({query:{isbn:"?9B574"}, onComplete: onComplete, onError: onError});			return d; //Object		},		function testReadAPI_fetch_pattern1(t){			//	summary: 			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match			//	description:			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();			var d = new doh.Deferred();			function onComplete(items, request) {				t.assertEqual(4, items.length);				d.callback(true);			}			function onError(error, request) {				d.errback(error);			}			store.fetch({query:{isbn:"A9B57?"}, onComplete: onComplete, onError: onError});			return d; //Object		},		function testReadAPI_fetch_pattern2(t){			//	summary: 			//		Simple test of fetching one xml items through an XML element called isbn with * pattern match			//	description:			//		Simple test of fetching one xml items through an XML element called isbn with * pattern match			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();			var d = new doh.Deferred();			function onComplete(items, request) {				t.assertEqual(5, items.length);				d.callback(true);			}			function onError(error, request) {				d.errback(error);			}			store.fetch({query:{isbn:"A9*"}, onComplete: onComplete, onError: onError});			return d; //Object		},		function testReadAPI_fetch_pattern_caseInsensitive(t){			//	summary: 			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match and in case insensitive mode.			//	description:			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match and in case insensitive mode.			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();			var d = new doh.Deferred();                                                             			function onComplete(items, request) {				t.assertEqual(1, items.length);				d.callback(true);			}			function onError(error, request) {				d.errback(error);			}			store.fetch({query:{isbn:"?9b574"}, queryOptions: {ignoreCase: true}, onComplete: onComplete, onError: onError});			return d; //Object		},		function testReadAPI_fetch_pattern_caseSensitive(t){			//	summary: 			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match and in case sensitive mode.			//	description:			//		Simple test of fetching one xml items through an XML element called isbn with ? pattern match and in case sensitive mode.			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();			var d = new doh.Deferred();                                                             			function onComplete(items, request) {				t.assertEqual(1, items.length);				d.callback(true);			}			function onError(error, request) {				d.errback(error);			}			store.fetch({query:{isbn:"?9B574"}, queryOptions: {ignoreCase: false}, onComplete: onComplete, onError: onError});			return d; //Object		},		function testReadAPI_getLabel(t){			//	summary: 			//		Simple test of the getLabel function against a store set that has a label defined.			//	description:			//		Simple test of the getLabel function against a store set that has a label defined.			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();						var d = new doh.Deferred();			function onComplete(items, request){				t.assertEqual(items.length, 1);				var label = store.getLabel(items[0]);				t.assertTrue(label !== null);				t.assertEqual("Table Row #3", label);				d.callback(true);			}			function onError(error, request) {				d.errback(error);			}			store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});			return d;		},		function testReadAPI_getLabelAttributes(t){			//	summary: 			//		Simple test of the getLabelAttributes function against a store set that has a label defined.			//	description:			//		Simple test of the getLabelAttributes function against a store set that has a label defined.			var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();						var d = new doh.Deferred();			function onComplete(items, request){				t.assertEqual(items.length, 1);				var labelList = store.getLabelAttributes(items[0]);				t.assertTrue(labelList === null);				d.callback(true);			}			function onError(error, request) {				d.errback(error);			}			store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});			return d;		},		function testReadAPI_getValue(t){			 //	summary: 			 //		Simple test of the getValue API			 //	description:			 //		Simple test of the getValue API			 var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();			 var d = new doh.Deferred();			 function onComplete(items, request) {				 t.assertEqual(1, items.length);				 var item = items[0];				 t.assertTrue(store.hasAttribute(item,"isbn"));				 t.assertEqual(store.getValue(item,"isbn"), "A9B574");				 d.callback(true);			 }			 function onError(error, request) {				 d.errback(error);			 }			 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});			 return d; //Object		},		function testReadAPI_getValues(t){			 //	summary: 			 //		Simple test of the getValues API			 //	description:			 //		Simple test of the getValues API			 var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();			 var d = new doh.Deferred();			 function onComplete(items, request) {				 t.assertEqual(1, items.length);				 var item = items[0];				 t.assertTrue(store.hasAttribute(item,"isbn"));				 var values = store.getValues(item,"isbn");				 t.assertEqual(1,values.length);				 t.assertEqual("A9B574", values[0]);				 d.callback(true);			 }			 function onError(error, request) {				 d.errback(error);			 }			 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});			 return d; //Object		},		function testReadAPI_isItem(t){			 //	summary: 			 //		Simple test of the isItem API			 //	description:			 //		Simple test of the isItem API			 var store = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();			 var d = new doh.Deferred();			 function onComplete(items, request) {				t.assertEqual(1, items.length);				var item = items[0];				t.assertTrue(store.isItem(item));				t.assertTrue(!store.isItem({}));				t.assertTrue(!store.isItem("Foo"));				t.assertTrue(!store.isItem(1));				d.callback(true);			 }			 function onError(error, request) {				 d.errback(error);			 }			 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});			 return d; //Object		},		function testReadAPI_isItem_multistore(t){			//	summary: 			//		Simple test of the isItem API across multiple store instances.			//	description:			//		Simple test of the isItem API across multiple store instances.			var store1 = dojox.data.tests.stores.HtmlTableStore.getBooksStore();			var store2 = dojox.data.tests.stores.HtmlTableStore.getBooks2Store();			var d = new doh.Deferred();			function onComplete1(items, request) {				t.assertEqual(1, items.length);				var item1 = items[0];				t.assertTrue(store1.isItem(item1));				function onComplete2(items, request) {					t.assertEqual(1, items.length);					var item2 = items[0];					t.assertTrue(store2.isItem(item2));					t.assertTrue(!store1.isItem(item2));					t.assertTrue(!store2.isItem(item1));					d.callback(true);				}				store2.fetch({query:{isbn:"A9B574"}, onComplete: onComplete2, onError: onError});			}			function onError(error, request) {				d.errback(error);			}			store1.fetch({query:{isbn:"1"}, onComplete: onComplete1, onError: onError});			return d; //Object		},		function testReadAPI_hasAttribute(t){

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -