开发者

Want to echo out html to extjs reader rather than json?

开发者 https://www.devze.com 2023-04-04 17:17 出处:网络
I am familiar with how to process json echoed data using datastores: new Ext.data.Store({ model: \"VehicleInfo\",

I am familiar with how to process json echoed data using datastores:

new Ext.data.Store({
        model: "VehicleInfo",
        proxy: {
            type: "ajax",
            url : "vehicleinfo.php",
            reader: {
                    type: "json"
            }
   开发者_开发知识库     },
        });     

But how do I configure the reader so that it accepts a html response? I plan to echo out the entire html response in a panel.

Thanks.


You may not want to use a store to update the panel contents. There are a few direct ways to update a panel body content. 1. Use the autoLoad in the config. 2. set html directly, possibly from some other ajax call. 3. use the Ext.Panel load method to have Ext make an ajax call and update the panel body with the response.

  panel = new Ext.Panel({
    renderTo: Ext.getBody(),
    width:450,
    frame:true,
    defaults:{autoHeight: true},
    // use autoLoad to have content created when the panel first renders
    autoLoad: 'vehicleinfo.php'
  });

  // use one or the other of the two below

  // set html directly
  panel.update('Examples of <strong>direct html<strong>');

  // set html by having Ext do an Ajax call to get panel content
  panel.load('vehicleinfo.php');
0

精彩评论

暂无评论...
验证码 换一张
取 消