投放本站广告请联系:
extjscn#126.com
定制:搜索框(Customizing: Search Field)
演示(demo)地址在文章最后.
效果图如下

主要文件custom.html,custom.js。
custom.html
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Custom Fields</title>
    <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
    <!-- GC -->
 	<!-- LIBS -->
 	<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
 	<!-- ENDLIBS -->
    <script type="text/javascript" src="../../ext-all.js"></script>
    <script type="text/javascript" src="SearchField.js"></script>
    <script type="text/javascript" src="custom.js"></script>
    <link rel="stylesheet" type="text/css" href="combos.css" />
    <style type="text/css">
        #search-results a {
            color: #385F95;
            font:bold 11px tahoma, arial, helvetica, sans-serif;
            text-decoration:none;
        }
        #search-results a:hover {
            text-decoration:underline;
        }
        #search-results .search-item {
            padding:5px;
        }
        #search-results p {
            margin:3px !important;
        }
        #search-results {
            border-bottom:1px solid #ddd;
            margin: 0 1px;
            height:300px;
            overflow:auto;
        }
        #search-results .x-toolbar {
            border:0 none;
        }
    </style>
    <!-- Common Styles for the examples -->
    <link rel="stylesheet" type="text/css" href="../examples.css" />
</head>
<body>
<script type="text/javascript" src="../examples.js"></script><!-- EXAMPLES -->
<p>
    <b>Custom Form Fields</b><br />
    Ext provides many types of form fields to build interactive and rich forms. However, it also
    provides a complete framework for building new types of fields quickly. The search field below
    is an example.
</p>
<p>The js is not minified so it is readable. See <a href="custom.js">custom.js</a>.</p>
<div style="width:600px;" id="search-panel">
</div>
</body>
</html>
custom.js
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * * * http://extjs.com/license */ Ext.onReady(function(){ var ds = new Ext.data.Store({ proxy: new Ext.data.ScriptTagProxy({ url: 'http://extjs.com/forum/topics-remote.php' }), reader: new Ext.data.JsonReader({ root: 'topics', totalProperty: 'totalCount', id: 'post_id' }, [ {name: 'postId', mapping: 'post_id'}, {name: 'title', mapping: 'topic_title'}, {name: 'topicId', mapping: 'topic_id'}, {name: 'author', mapping: 'author'}, {name: 'lastPost', mapping: 'post_time', type: 'date', dateFormat: 'timestamp'}, {name: 'excerpt', mapping: 'post_text'} ]), baseParams: {limit:20, forumId: 4} }); // Custom rendering Template for the View var resultTpl = new Ext.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>' ); var panel = new Ext.Panel({ applyTo: 'search-panel', title:'Forum Search', height:300, autoScroll:true, items: new Ext.DataView({ tpl: resultTpl, store: ds, itemSelector: 'div.search-item' }), tbar: [ 'Search: ', ' ', new Ext.app.SearchField({ store: ds, width:320 }) ], bbar: new Ext.PagingToolbar({ store: ds, pageSize: 20, displayInfo: true, displayMsg: 'Topics {0} - {1} of {2}', emptyMsg: "No topics to display" }) }); ds.load({params:{start:0, limit:20, forumId: 4}}); });
- 关键字:
- 要发表评论,请先登录



评论
field默认显示内容
field有没有一属性像combo的emptyText一样,当然鼠标点击后默认combo默认显示的文字就会自动消失
主题:
独特的和缤纷的网站。我访问了许多网站,但这个人是无与伦比的。我寻找的mcts practice exam。以及有关 mcse practice exam 想要写一篇关于它不能在这段时间内忽视 vmware practice exam 文章。