Suggested case list:
Using timer to refresh a grid
383guest172.69.33.12125nk0uiMay 7, 2020 7:23:47 AMlinkuser model to move item to another listbox
120guest162.158.193.148d0n3krApr 2, 2020 5:28:28 AMlinkDisabled list item row passed to VM-1981
296fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:44 PMlinkDisabled list item row passed to VM-1981
295fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:16 PMlinkDisabled list item row passed to VM-1981
294fatih123160.83.36.13225nk0uiFeb 13, 2018 3:30:44 PMlinkgrid sample with ListModel/RowRenderer
816guest80.82.2.1312vah9ajFeb 21, 2017 11:42:21 AMlinkgrid sample with ListModel/RowRenderer
809guest175.98.113.1622vah9ajJan 26, 2017 9:19:33 AMlinkgrid sample with ListModel/RowRenderer
196guest79.185.142.402vah9ajApr 26, 2014 10:53:57 PMlinkgrid sample with ListModel/RowRenderer
195guest79.185.142.402vah9ajApr 26, 2014 10:53:54 PMlinkgrid sample with ListModel/RowRenderer
194guest79.185.142.402vah9ajApr 26, 2014 10:53:51 PMlinkgrid sample with ListModel/RowRenderer
193guest79.185.142.402vah9ajApr 26, 2014 10:53:48 PMlinkgrid sample with ListModel/RowRenderer
192guest79.185.142.402vah9ajApr 26, 2014 10:53:44 PMlinkgrid sample with ListModel/RowRenderer
191guest79.185.142.402vah9ajApr 26, 2014 10:53:40 PMlinkHierarchy table without using ZK PE/EE
1aaknai151.28.135.2131s871daJul 29, 2013 11:02:46 PMlinkgrid sample with ListModel/RowRenderer
128aaknai151.28.135.2132vah9ajJul 29, 2013 7:20:00 PMlinkuser model to move item to another listbox
1TonyQ114.25.109.94d0n3krApr 21, 2012 10:43:27 AMlinkUsing timer to refresh a grid
1TonyQ220.133.44.3725nk0uiFeb 17, 2012 3:17:34 AMlinkFire a event from child iframe
1TonyQ220.133.44.372eupjotFeb 3, 2012 5:04:52 AMlinkTextbox input restriction sample
1TonyQ72.21.245.2431b3nlr0Dec 20, 2011 10:09:10 AMlinkTest web core taglib in ZUL
1TonyQ198.203.175.175ofqkemDec 17, 2011 3:36:08 AMlinkLatest 10 Fiddles :
frozen scroll
1guest172.69.33.373j82a06Mar 28, 2024 8:03:44 AMlinkGmarker and forEach
1guest172.68.67.1362lpvk1hMar 28, 2024 7:29:50 AMlinkGmaps
1guest172.68.67.1363dvghg5Mar 28, 2024 7:28:20 AMlinkgrid demo
5guest172.71.158.2371grhhu3Mar 27, 2024 7:46:36 AMlinkgrid demo
4guest172.71.158.2371grhhu3Mar 27, 2024 7:46:25 AMlinkgrid demo
3guest172.71.154.181grhhu3Mar 27, 2024 7:44:16 AMlinkgrid demo
2guest172.71.154.181grhhu3Mar 27, 2024 7:43:58 AMlinkgrid demo
1guest172.71.154.191grhhu3Mar 27, 2024 7:42:54 AMlinkScrollable Panel
13guest172.69.223.193ctlblaMar 27, 2024 5:31:21 AMlinkScrollable Panel
12guest172.69.223.194ctlblaMar 27, 2024 5:30:56 AMlinkAnother new ZK fiddle
5guest172.70.206.931955k98Apr 28, 2022 10:42:50 AMlinkresources
index.zulzul<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<!-- workaround (uncomment to test) -->
<!--<script src="./workaround.js"/>-->
<window title="bug drop upload" border="normal" viewModel="@id('vm') @init('pkg$.GridModel')">
<div height="200px">
BIG FORM
BIG FORM
BIG FORM
BIG FORM
</div>
<listbox model="@bind(vm.article)" >
<listhead>
<listheader label="Article" />
<listheader label="Upload Image" />
</listhead>
<template name="model">
<listitem>
<listcell><label value="@bind(each.code)"/></listcell>
<listcell><div><image height="200px"></image><dropupload maxsize="-1" content="content" detection="browser" anchor="${self.getParent().getFirstChild()}" onUpload="self.getParent().getFirstChild().setContent(event.media)"/></div></listcell>
</listitem>
</template>
</listbox>
</window>
</zk>GridModel.javajavaimport java.util.ArrayList;
import java.util.List;
public class GridModel {
private List<Article> article;
public List<Article> getArticle() {
return article;
}
public void setArticle(List<Article> article) {
this.article = article;
}
public GridModel()
{
this.loadArticle();
}
public void loadArticle()
{
this.article=new ArrayList<Article>();
Article art;
for (int i=0;i<30;i++)
{
art=new Article();
art.setCode("A");
this.article.add(art);
art=new Article();
art.setCode("B");
this.article.add(art);
}
}
}
Article.javajavapublic class Article {
private String code;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
workaround.jsjavascript zk.afterLoad("zkmax.wgt", function () {
/*global manager*/
var _dragShows = {};
/*fn definition*/
function _preventDefault(evnt) {
evnt.stop();
}
function _unBanBrowserDrop() {
jq(document).off('dragenter dragover', _stopAndNoneEffect);
}
function _stopAndNoneEffect(evnt) {
_preventDefault(evnt);
_noneEffect(evnt);
}
function _noneEffect(evnt) {
evnt.originalEvent.dataTransfer.dropEffect = 'none';
}
/* overrides */
var _xDropupload = {};
zk.override(zkmax.wgt.Dropupload.prototype, _xDropupload, {
_dragShow: function (evnt) {
_preventDefault(evnt);
if (evnt.originalEvent.dataTransfer.types.length) {
var fileType = evnt.originalEvent.dataTransfer.types[0];
if (fileType != 'Files' // Chrome, IE, Opera
&& fileType != 'public.file-url' // safari
&& fileType != 'application/x-moz-file') { // Firefox
_banBrowserDrop();
return; // Bug ZK-2767
}
_unBanBrowserDrop();
}
if (evnt.originalEvent.dataTransfer.dropEffect != 'copy') {
_noneEffect(evnt);
}
this._shallHide = false;
_dragShows[this.uuid] = this;
var n = this.$n(),
last = this._last,
auuid = this._anchorUuid,
size = 0, key;
for (key in last) {
if (last[key]) size++;
}
var shallSyncSize = this._shallSyncSize;
if (n) {
if (auuid) {
var lastAnchor = this._lastAnchor || {},
$anchor = jq(auuid, zk),
$n = jq(n),
ofs = $anchor.offset(),
nofs = $n.offset(),
newWidth = $anchor.width(),
newHeight = $anchor.height(),
newTop = ofs.top - window.scrollY, newLeft = ofs.left - window.scrollX;
//ZK-2751, if anchor's properties have changed, shallSyncSize = true
if (lastAnchor['w'] != newWidth || lastAnchor['h'] != newHeight
|| lastAnchor['t'] != newTop || lastAnchor['l'] != newLeft) {
shallSyncSize = true;
lastAnchor['w'] = newWidth;
lastAnchor['h'] = newHeight;
lastAnchor['t'] = newTop;
lastAnchor['l'] = newLeft;
this._lastAnchor = lastAnchor;
}
if (shallSyncSize) {
n.style.position = 'fixed';
n.style.zIndex = '10000';
if (size == 0) {
var nWidth = $n.width(), nHeight = $n.height();
last['w'] = nWidth ? nWidth + 'px' : '';
last['h'] = nHeight ? nHeight + 'px' : '';
last['t'] = nofs.top ? nofs.top + 'px' : '';
last['l'] = nofs.left ? nofs.left + 'px' : '';
}
if ($anchor.length > 0) {
n.style.width = newWidth + 'px';
n.style.height = newHeight + 'px';
n.style.top = newTop + 'px';
n.style.left = newLeft + 'px';
}
}
} else if (shallSyncSize) {
// has last size
n.style.position = 'static';
n.style.zIndex = 'auto';
n.style.width = last['w'] || '100px';
n.style.height = last['h'] || '100px';
n.style.top = last['t'] || 'auto';
n.style.left = last['l'] || 'auto';
this._last = {};
}
this._shallSyncSize = false;
}
this.setVisible(true);
},
unbind_: function () {
var detection = this.getDetection(),
self = jq(this.$n()).off('drop', this.proxy(this._dropAction)),
area = jq(this.$f(detection));
if (detection == 'self') {
self.off('dragenter dragover', this.proxy(this._showContent))
.off('dragleave', this.proxy(this._hideContent));
_unBanBrowserDrop();
} else if (detection == 'none') {
self.off('dragenter dragover', _stopAndCopyEffect);
_unBanBrowserDrop();
} else if (detection == 'browser' || !area.length) {
self.off('dragenter dragover', _copyEffect)
.off('dragleave', _noneEffect);
_undetectionBrowser(this);
} else {
self.off('dragenter dragover', _stopAndCopyEffect);
area.off('dragenter dragover', this.proxy(this._showContentNoneDrop))
.off('dragleave', this.proxy(this._hideContent));
_unBanBrowserDrop();
}
if (_dragShows[this.uuid]) {
delete _dragShows[this.uuid];
}
this.$supers('unbind_', arguments);
},
_dragHide: function (evnt) {
_preventDefault(evnt);
delete _dragShows[this.uuid];
if (!this._shallHide) {
var self = this;
setTimeout(function () {
if (self && self.desktop && self._shallHide) {
self.setVisible(false);
}
}, 50);
}
this._shallHide = true;
},
_dropAction: function (evnt) {
_preventDefault(evnt);
// hide all others.
for (var id in _dragShows)
this._dragHide.call(_dragShows[id], evnt);
if (this.getDetection() == 'self') {
this._setContentVisible(false);
}
var files = evnt.originalEvent.dataTransfer.files,
filesCount = files.length;
if (this._maxFileCount != -1 && filesCount > this._maxFileCount) {
this.fire('onMaxFileCountExceed', {filesCount: filesCount});
return;
}
// the size of each file must be smaller than maxsize, or reject whole upload.
var maxsize = this._maxsize > 0 ? this._maxsize * 1024 : -1;
if (maxsize != -1) {
var alert = [];
for (var i = 0; i < filesCount; i++) {
var file = files[i],
size = file.size,
kbFileSize = size / 1024,
kbMaxSize = maxsize / 1024,
kb = ' ' + msgzk.KBYTES,
mb = ' ' + msgzk.MBYTES,
fileKBytes = Math.round(kbFileSize) + kb,
maxKBytes = Math.round(kbMaxSize) + kb;
if (size > maxsize) {
var formatFileSize = zk.fmt.Text.formatFileSize;
alert.push(file.name);
alert.push(zk.fmt.Text.format(msgzul.UPLOAD_ERROR_EXCEED_MAXSIZE,
formatFileSize(size), formatFileSize(maxsize), size, maxsize, fileKBytes, maxKBytes,
Math.round(kbFileSize / 1024) + mb, Math.round(kbMaxSize / 1024) + mb));
}
}
if (alert.length > 0) {
this.showError_(alert);
return;
}
}
//ZK-2785: dropupload freezes when dropping a folder (in Chrome)
var items = evnt.originalEvent.dataTransfer.items;
for (var i = 0; i < filesCount; i++) {
var skipFolder = false;
if (items) {
var entry = items[i];
if (entry.getAsEntry) { //Standard HTML5 API
skipFolder = entry.getAsEntry().isDirectory;
} else if (entry.webkitGetAsEntry) { //WebKit implementation of HTML5 API.
skipFolder = entry.webkitGetAsEntry().isDirectory;
}
}
if (!skipFolder) {
this._sid++;
var uploader = new zkmax.wgt.DropUploader(this, this._genKey(), files[i]);
this._uploaders[uploader.id] = uploader;
}
}
this.checkFinish();
}
});
});