Sigma Php Ajax framework, Ajax Components, GUI Builder
May 17, 2012, 12:34:57 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
Sigma Php Ajax framework, Ajax Components, GUI Builder
>
Sigma Grid
>
Sigma Grid - Q&A
(Moderators:
steven
,
gbolanoscruz
) >
Ext.ux.grid.DataDrop
Pages: [
1
]
« previous
next »
Print
Author
Topic: Ext.ux.grid.DataDrop (Read 782 times)
bell
Newbie
Posts: 4
Ext.ux.grid.DataDrop
«
on:
July 11, 2010, 06:55:13 AM »
Hi,
Can some body tel me if we can modify this plugin to work with sigma grid ?
This plugin is used on ExtJS grid, giving that grid the ability to accept data dragged from spreadsheet programs such as Excel and OpenOffice Calc right into the grid to create rows of data.
The code :
Ext.ux.grid.DataDrop = (function(){ var lineEndRE = /\r\n|\r|\n/, sepRe = /\s*\t\s*/; // After the GridView has been rendered, insert a static transparent textarea over it. function onViewRender(){ var v = this.view; if (v.mainBody) { this.textEl = Ext.DomHelper.insertAfter(v.scroller, { tag: 'textarea', id: Ext.id(), value: '', style: { 'font-size': '1px', border: '0px none', overflow: 'hidden', color: '#fff', position: 'absolute', top: v.mainHd.getHeight() + 'px', left: '0px', 'background-color': '#fff', margin: 0, cursor: 'default' } }, true); this.textEl.setOpacity(0.1); this.textEl.forwardMouseEvents(); this.textEl.on({ mouseover: function(){ Ext.TaskMgr.start(this.changeValueTask); }, mouseout: function(){ Ext.TaskMgr.stop(this.changeValueTask); }, scope: this }); resizeDropArea.call(this); } } // on GridPanel resize, keep scroller height correct to accomodate textarea. function resizeDropArea(){ if (this.textEl) { var v = this.view, sc = v.scroller, scs = sc.getSize, s = { width: sc.dom.clientWidth || (scs.width - v.getScrollOffset() + 2), height: sc.dom.clientHeight || scs.height }; this.textEl.setSize(s); } } // on change of data in textarea, create a Record from the tab-delimited contents. function dataDropped(e, el){ var nv = el.value; el.blur(); if (nv !== '') { var store = this.getStore(), Record = store.recordType; el.value = ''; var rows = nv.split(lineEndRE), cols = this.getColumnModel().getColumnsBy(function(c){ return !c.hidden; }), fields = Record.prototype.fields; if (cols.length && rows.length) { for (var i = 0; i < rows.length; i++) { var vals = rows[i].split(sepRe), data = {}; if (vals.join('').replace(' ', '') !== '') { for (var k = 0; k < vals.length; k++) { var fldName = cols[k].dataIndex; var fld = fields.item(fldName); data[fldName] = fld ? fld.convert(vals[k]) : vals[k]; } var newRec = new Record(data); store.add(newRec); var idx = store.indexOf(newRec); this.view.focusRow(idx); Ext.get(this.view.getRow(idx)).highlight(); } } resizeDropArea.call(this); } } } return { init: function(cmp){ Ext.apply(cmp, { changeValueTask: { run: function(){ dataDropped.call(this, null, this.textEl.dom); }, interval: 100, scope: cmp }, onResize: cmp.onResize.createSequence(resizeDropArea) }); cmp.getView().afterRender = cmp.getView().afterRender.createSequence(onViewRender, cmp); } }; })();
Thanks
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News & Announcements
-----------------------------
Sigma Visual GUI Builder & Library
-----------------------------
=> Sigma Visual - Knowledge Share
=> Sigma Visual - Q&A
=> Bug Report & Wishlist
-----------------------------
Sigma Grid
-----------------------------
=> Sigma Grid - Q&A
=> Show Case
=> Bug Report & Wishlist
-----------------------------
Other
-----------------------------
=> AJAX & JavaScript
Loading...