Ext.define("Portfolio.entity.view.Html", {

	xtype: "portfolio-entity-view-html",

	extend: "Ext.container.Container",

	alias: [
		"widget.entity.view.Html",
	],

    layout: "fit",
    
    padding: 5,

    autoScroll: true,
    
    listeners: {
        updateselected: {
            fn: function(i_self, i_record) {

                var n_id = i_record.get(i_record.idProperty);

                i_self.setLoading(true);

                i_self.removeAll(true);

                Ext.Ajax.request({
                    url: "/ip2-services/ip2dmdProxy.aspx",
                    jsonData: {
                        batch:[
                            {
                                cmd: [
                                    "select  a.NTFNTFTKN,  a.NTFMSG  from WSHNTFTR00 as a",
                                    "where "+ i_record.idProperty + " = " + n_id
                                ].join(" "),
                                limit: 100,
                                start: 0,
                                type: "sql"
                            }
                        ]
                    },
                    success: function (i_response, i_request) {
        
                        var o_result = Ext.decode(i_response.responseText, true) || {
                            success: false,
                            batch: [
                                {
                                    rows: []
                                }
                            ]
                        };

                        var o_batch = o_result.batch[0] || {};
        
                        var o_row = o_batch.rows[0] || {};
        
                        i_self.update(o_row.NTFMSG);

                        i_self.setLoading(false);
                    },
                    failure: function() {
                        i_self.setLoading(false);
                    }
                });
            }
        }
    },

	initComponent: function() {

		var i_self = this;
		i_self.callParent();
	},
});
