Results 1 to 2 of 2

Thread: Populate grid from Inline XML (XmlReader)

  1. #1
    Ext User
    Join Date
    Mar 2008
    Vote Rating

    Thumbs up Populate grid from Inline XML (XmlReader)

    After a bit of struggle i am able to use inline xml. Here is my two cents. Thanks for the_bagbournes for his help.

    * Ext JS Library 2.0.2
    * Copyright(c) 2006-2008, Ext JS, LLC.
    var xmlstr = "<Items>"+
    "<Author>Sidney Sheldon</Author>"+
    "<Manufacturer>Warner Books</Manufacturer>"+
    "<Title>Master of the Game</Title>"+
    "<Author>Sidney Sheldon</Author>"+
    "<Manufacturer>Warner Books</Manufacturer>"+
    "<Title>Are You Afraid of the Dark?</Title>"+
    var doc;
    if (window.ActiveXObject) {
    var doc = new ActiveXObject("Microsoft.XMLDOM");
    doc.async = "false";
    else {
    var doc = new DOMParser().parseFromString(xmlstr,"text/xml");
    var xmlReader = new{
    // records will have an "Item" tag
    record: 'Item',
    id: 'ASIN',
    totalRecords: '@total'
    }, [
    // set up the fields mapping into the xml doc
    // The first needs mapping, the others are very basic
    {name: 'Author', mapping: 'ItemAttributes > Author'},
    'Title', 'Manufacturer', 'ProductGroup'
    var store = new{
    proxy: new,
    reader: xmlReader
    var grid = new Ext.grid.GridPanel({
    store: store,
    columns: [
    {header: "Author", width: 120, dataIndex: 'Author', sortable: true},
    {header: "Title", width: 180, dataIndex: 'Title', sortable: true},
    {header: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true},
    {header: "Product Group", width: 100, dataIndex: 'ProductGroup', sortable: true}
    Jaweed sarfraz
    Attached Files Attached Files
    Last edited by joji_khan; 12 Mar 2008 at 2:18 PM. Reason: Attachment Added

  2. #2
    Ext User
    Join Date
    Apr 2008
    Vote Rating

    Default dynamic xml

    Can you please tell me how to use dynamic xml with this code. I am getting dynamic xml with java servlet but do not know how to make an object of it. I want to create doc with my dynamic xml as you are creating in your example.
    CODE]proxy: new[[/CODE]
    and I want ot make a string of my dynamic xml.

    var xmlstr = dynamic xml
    but I really do not know how to make a string of my xml. My xml has 500 records. I display xml with
    'http://localhost:8080/fastcarfm/servive/new/' url
    <part><a = "1"></a><b = "2"></b></part>
    <part><d = "1"></d><b = "2"></b></part>
    <part><c = "1"></c><n = "2"></n></part>
    <part><g = "1"></g><m = "2"></m></part>

    I want to display this xml in a grid with paging memory proxy.
    Please help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts