function GridBasic() {
        //1. 定义表格
        var cm = new Ext.grid.ColumnModel([
        { header: '编号', dataIndex: 'id',sortable:true},
        { header: '性别', dataIndex: 'sex',sortable:true},
        { header: '名称', dataIndex: 'name',width:'20',sortable:true},
        { header: '描述', dataIndex: 'desciption',width:'10',sortable:true}
        ]);
         //2. 创建数据源
        var data = [
        ['1','男','张三丰','是个作家'],
        ['2','男','石曼迪','会武功'],
        ['3','男','姜子牙','能捉鬼'],
        ['4','女','穆桂英','好像是皇帝'],
        ['5','男','孙悟空','高级程序员'],
['6','男','张三丰','是个作家'],
        ['7','男','石曼迪','会武功'],
        ['8','男','姜子牙','能捉鬼'],
        ['9','女','穆桂英','好像是皇帝'],
        ['10','男','孙悟空','高级程序员']
        ];
        var ds = new Ext.data.Store({
            proxy: new Ext.data.MemoryProxy(data),
            reader: new Ext.data.ArrayReader({}, [
            { name: 'id' },{ name: 'sex' },{ name: 'name' },{ name: 'desciption' }
             ])
                });
       


         var grid = new Ext.grid.GridPanel({
        el:'grid',
        ds: ds,
        cm: cm,
        width: 500,
        height: 260,
        viewConfig: {
            forceFit: true
        },
        bbar:new Ext.PagingToolbar({
            pageSize:5,
            store:ds,
            displayInfo: true,
            displayMsg: '显示第{0}条到{1}条记录,一共{2}条数据',
            emptyMsg: "没有记录"
        })
    });
      grid.render();
 ds.load();
       

    }
    Ext.onReady(GridBasic); //
</script>
 

解决方案 »

  1.   

       extjs 没用过,但是我看你设置的属性里面是不是少了一个 paganation=true(是否分页)的设置?
    然后是否还有一个 pagenow(当前显示页数) 的设置呢 ?
      

  2.   

    在ext-2.3.0\examples\locale有个例子multi-lang.html里有讲解,但是不知道哪一行是我需要的
      

  3.   

    {"totalCount":"65042","topics":[{"threadid":"126281","forumid":"11","forumtitle":"Ext: Premium Help","title":"trigger store function from the form","author":"alonal","lastposter":"jsakalos","lastpost":"1299715490","excerpt":"Hi\n\nWhen i write \nmyForm.getForm().updateRecord(this.record); it triggers the store to call update function. the form tirggers the update function in the store, I do not trigger it directly.\n How do i trigger create function when a new record is added from the form (i mean, what do i need to write...","replycount":"1"},...]}这是extjs 3.3.1版本的例子,注意他的数据结构,totalCount总条数,topics信息头这是例子中的js,你可以把proxy换成你的固定数据试试var store = new Ext.data.JsonStore({
            root: 'topics',
            totalProperty: 'totalCount',
            idProperty: 'threadid',
            remoteSort: true,        fields: [
                'title', 'forumtitle', 'forumid', 'author',
                {name: 'replycount', type: 'int'},
                {name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp'},
                'lastposter', 'excerpt'
            ],        // load using script tags for cross domain, if the data in on the same domain as
            // this page, an HttpProxy would be better
            proxy: new Ext.data.ScriptTagProxy({
                url: 'http://extjs.com/forum/topics-browse-remote.php'
            })
      

  4.   

    我看了extjs 3.1的版本,当我使用jsp把它那个url改为jsp就是本地的时候不能够引用数据,如果改为http://那就可以了
      

  5.   

      var ds = new Ext.data.Store重写stroe使之实现分页显示数据
      

  6.   

    但是那个extjs必须是php我想模拟一些本地数据都不可以了,我想改变数据字段怎么办呢