1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    9
    Vote Rating
    0
    dasara is on a distinguished road

      0  

    Default How to implement page navigtion in Grid

    How to implement page navigtion in Grid


    Hi All,

    I'm working with Grid and I'm trying to keep a navigation (or paging to navigate some records at a time). But when i use initPaging() method I'm getting the structure of navigation but I'm unable to navigate between the records. In initPaging() method we have to specify the URL but i don't have any URL to pass the records. I'm just using the JSONDataModel to create dataModel. My code is given below

    onLoad : function(){ alert("inload");this.grid.getSelectionModel().selectFirstRow();},
    init : function() { var schema = { root: 'Users', totalProperty: 'Total', id: 'user', fields: ['Name','Password','Id'] };
    var dataObj = {'Users':[{'Name':'Samba','Password':'zxcv','Id':'123'},{'Name':'Stephen','Password':'qwer','Id':'123'},{'Name':'John','Password':'asdf','Id':'123'}]};
    var data=eval(dataObj);
    var columns= [{ header: "Name", width: 110, sortable: true },{ header: "Password", width: 130, sortable: true },{ header: "Id", width: 75, sortable: true }];
    this.dataModel = new YAHOO.ext.grid.JSONDataModel(schema);
    this.colModel = new YAHOO.ext.grid.DefaultColumnModel(columns);
    this.selModel = new YAHOO.ext.grid.SingleSelectionModel();
    this.dataModel.initPaging(null,10);
    this.grid = new YAHOO.ext.grid.Grid('example-grid',this.dataModel,this.colModel,this.selModel);
    this.grid.dataModel.loadData(data);
    this.grid.render(true);

    I also tried this.grid.getview().getPageToolbar() to add navigation tool bar but its not working.

    So where and How can i use initPaging() where data is in the form of string.
    Is there any way to overcome this to keep navigationbar (or paging).

    Thanks in advance,

  2. #2
    Ext User
    Join Date
    Mar 2007
    Posts
    12
    Vote Rating
    0
    das88 is on a distinguished road

      0  

    Default


    Paging is generally used to get a subset of the records so they do not all have to be transferred from the server to the client at the same time. If all of your records already exist in the page in the dataObj, you can just display all of them - there is no reason to page in this situation that I can think of.

  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    9
    Vote Rating
    0
    dasara is on a distinguished road

      0  

    Default Problem with data

    Problem with data


    Thanks Mr Das88,

    In that page i have huge amount of records are there. But i want to display some of them at a time. I have shown how i loading the data into dataModel.

    the string
    Code:
    {'Users':[{'Name':'Samba','Password':'zxcv','Id':'123'},{'Name':'Stephen','Password':'qwer','Id':'123'},{'Name':'John','Password':'asdf','Id':'123'}]};
    is evaluated into an object
    Code:
    var dataObj = {'Users':[{'Name':'Samba','Password':'zxcv','Id':'123'},{'Name':'Stephen','Password':'qwer','Id':'123'},{'Name':'John','Password':'asdf','Id':'123'}]};
    var data=eval(dataObj);
    here i have shown you just three records. but actually so many records are there. So i want to display some of them at a time. is it possible to keep navigation buttons in the grid and display the records. Is there any coding is required or any function to work it out.

    I also tried
    Code:
    this.grid.getView().getPagedToolbar().
    But it didn't work.

    I'm using Mozilla Firefox browser.

    It would be a great help for me if you could help me out.

    Thanks in Advance,

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,498
    Vote Rating
    46
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    So, you have a "huge" amount of records, and want to use paging, but you are planning to pass all the records into a huge dataObj, and page from that?

    Why?

    If you really have lots of data, you will want to page from a server.

  5. #5
    Ext User
    Join Date
    Mar 2007
    Posts
    14
    Vote Rating
    0
    choni is on a distinguished road

      0  

    Default have the same problem

    have the same problem


    Well, that idea is not so crazy after all, I also have a huge amout of objetcs on the client side but still need tha grid to display de paging. Reason? because too much data on the grid slows down all the layout operations of borderLayout, also to change the panels, order de grid, besides, one of my columns displays an imagen, can you image loading over 1000 images?? my browser takes forever!, so, for me, client-server communication is no a problem, instead, the problem lies in how to page through the records once they are in the client.

    Any help will be appreciatted.

    Thanks!

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,498
    Vote Rating
    46
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    With no url provided in initPaging() it won't fill the grid.

    You will have to override the load method in your data model to load data from the huge Array of data that you've passed into the browser :roll: :roll: :roll: :roll:

  7. #7
    Ext User
    Join Date
    Mar 2007
    Posts
    14
    Vote Rating
    0
    choni is on a distinguished road

      0  

    Default


    yeah, looks like I'm gonna have to do that. Anyway, I'll try to work on the URL version, I mean, passing only to the browser what it's going to show, with a URL.

    Thanks man!

  8. #8
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,498
    Vote Rating
    46
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Yes that's te correct thing to do. If you do have a "huge" dataset, then paging from the server is the only way to go.

    No point in downloading the whole dataset into the browser. It would slow the page load down. Plus, humans can only mentally handle a limited amount of data. Give them 1000 rows, and they'll just zone out - or re-do the query to be more specific.

    It should be quite easy to come up with a servlet (or whetever) which produces the JSON.

  9. #9
    Ext User
    Join Date
    Mar 2007
    Posts
    14
    Vote Rating
    0
    choni is on a distinguished road

      0  

    Default


    Yeah, I'm working with .NET 1.1 on the server, and I have a library that does the conversion to JSON, I just have been lazy

    Ok, thanks a lot!

Similar Threads

  1. How to implement GZIP using PHP
    By manugoel2003 in forum Community Discussion
    Replies: 10
    Last Post: 3 Aug 2007, 1:10 PM
  2. Unable to implement a Custom Renderer, please help!
    By MatteoSp in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 31 Mar 2007, 4:16 AM
  3. How to implement a CustomRenderer
    By mauro_monti in forum Ext 1.x: Help & Discussion
    Replies: 6
    Last Post: 28 Feb 2007, 11:10 AM
  4. Page Down and Page Up for Grid Rows Navigation?
    By dewd in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 19 Feb 2007, 10:46 AM
  5. Trying to implement Basic Resizable around iFrame
    By bernieott in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 21 Dec 2006, 6:06 AM

Thread Participants: 3

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."