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

📄 customscript.cs

📁 经典编程900例(C语言),主要是C基础知识
💻 CS
字号:
using System;
using System.DHTML;
using Ext;
using Ext.data;

namespace SampleScripts.menu {
    public class CustomScript {

        public static void main(Dictionary args) {
			ExtClass.onReady(new AnonymousDelegate(delegate() { new CustomScript().init(); }));
        }

        public void init() {

		   Store ds = new Store(new StoreConfig()
				.custom("proxy", new ScriptTagProxy(new ScriptTagProxyConfig()
					.url("http://extjs.com/forum/topics-remote.php")
					.ToDictionary()))
				.reader(new JsonReader(new JsonReaderConfig()
					.root("topics")
					.totalProperty("totalCount")
					.id("post_id")
					.ToDictionary(),
					new object[] {
						new Dictionary("name", "postId", "mapping", "post_id"),
						new Dictionary("name", "title", "mapping", "topic_title"),
						new Dictionary("name", "topicId", "mapping", "topic_id"),
						new Dictionary("name", "author", "mapping", "author"),
						new Dictionary("name", "lastPost", "mapping", "post_time", "type", "date", "dateFormat", "timestamp"),
						new Dictionary("name", "excerpt", "mapping", "post_text")}))

				.baseParams(new Dictionary("limit", 20, "forumId", 4))
				.ToDictionary());

			// Custom rendering Template for the View
			XTemplate resultTpl = new XTemplate(
				@"<tpl for=""."">
				<div class=""search-item"">
					<h3><span>{lastPost:date(""M j, Y"")}<br />by {author}</span>
					<a href=""http://extjs.com/forum/showthread.php?t={topicId}&p={postId}"" target=""_blank"">{title}</a></h3>
					<p>{excerpt}</p>
				</div></tpl>"
			);

			new Panel(new PanelConfig()
				.applyTo("search-panel")
				.title("Forum Search")
				.height(300)
				.autoScroll(true)

				.items(new DataView(new DataViewConfig()
					.tpl(resultTpl)
					.store(ds)
					.itemSelector("div.search-item")
					.ToDictionary()))

				//.tbar(new object[] {
				//    "Search( ", " ",
				//    new SearchField(new SearchFieldConfig()
				//        .store(ds)
				//        .width(320)
				//        .ToDictionary())
				//})

				.bbar(new PagingToolbar(new PagingToolbarConfig()
					.store(ds)
					.pageSize(20)
					.displayInfo(true)
					.displayMsg("Topics {0} - {1} of {2}")
					.emptyMsg("No topics to display")
					.ToDictionary()))

				.ToDictionary());

			ds.load(new Dictionary("params", new Dictionary("start", 0, "limit", 20, "forumId", 4)));
		}
    }
}

⌨️ 快捷键说明

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