Dojo method Overload: custom DESCRIPTION as an enhancedGrid

The following are the chat records of a certain group on a certain year, a certain day, and a certain day:

< td id="tn" style="font-size:9pt; border:1px solid transparent">

【Legend】JOY PB(529058939) 18:30:45

< tr id="itemId_46">

The paging of the grid, or a separate paging

【Legend 】JOY PB(529058939) 18:24:29

enhancedGrid paging

【Legend】JOY PB(529058939) 18:25:11

The description information in the lower left corner, which is the information on the first few pages, how to modify it?

【Talk】RIAStudio(228456440) 18:26:29

show css or what

[Legend] JOY PB(529058939) 18:26:50

wait, let me take a screenshot

【话唠】RIAStudio(228 456440) 18:26:52

css, directly load a own css file

【Legend】JOY PB(529058939) 18: 27:11

not css, but the template content inside

【Legend】JOY PB(529058939) 18:28:02

[Legend] JOY PB(529058939) 18:28:02 /div>

【Talk】RIAStudio(228456440) 18:28:17
never used

[Legend] JOY PB(529058939) 18:28:24

dojox\grid\enhanced\nls\zh\Pagination.js under this file

【Talk】RIAStudio(228456440) 18:28:44

< div class="msgContentDiv" style="margin-top:5px; padding-left:20px; width:300px; overflow-x:hidden"> This is a string template

【Legend】JOY PB(529058939) 18:28:48

You have to tell me, have you never used dijit? . .

【话唠】RIAStudio(228456440) 18:28:53

There are 4 parameters

[Legend] JOY PB(529058939) 18:28: 59

You write it all by yourself. . .

【话唠】RIAStudio(228456440) 18:29:05

This is its own, not universal < /div>

【Legend】JOY PB(529058939 ) 18:29:32

< span style="color:000000; font-size:10pt; font-family:Microsoft Yahei,'MS Sans Serif',sans-serif">Can it be modified

【Talk】RIAStudio(228456440) 18:29:52
What do these 4 parameter subtables represent? You can search descTemplate to find out where it matches

【話唠】RIAStudio(228456440) 18: 30:00

can definitely be changed

【Talk】RIAStudio(228456440) 18:30:22

but it needs to be modified by overloading, it is best not to directly modify the original control
< div style="float:left; margin-right:3px"> 【Legend】JOY PB(529058939) 18:31:07

enhancedGrid’s pagination plugin has nls

【Talk】RIAStudio(228456440) 18:31:23

nls is multi-language, it doesn’t matter to this

【Legend】JOY PB(529058939) 18:31:31

Yes, I don’t want to modify his source file.

【Talk】RIAStudio(228456440) 18:32:03

Wait, help you find it< /span>

[Legend] JOY PB(529058939) 18:32:07

【 Legend] JOY PB(529058939) 18:32:24

This is the call in it

【話唠】RIAStudio(228456440) 18 :36:38

dojox\grid\enhanced\nls\zh\Pagination.js This file is 399 lines

_updateDescription: function(){
// summary:
// Update size information.
vars = this.plugin.forcePageStoreLayer,
maxSize = this.plugin._maxSize,
nls = this.plugin._nls,
getItemTitle = function(){
return maxSize<= 0||maxSize== 1? nls[5]: nls[4];
};
if(this.description&& this.descriptionDiv){
this.descriptionDiv.innerHTML= maxSize> 0? string.substitute(nls[0],[getItemTitle(), maxSize, s.startIdx + 1,s.endIdx + 1]): “0” + getItemTitle();
}
},
Overload this method

【Talk】RIAStudio(228456440) 18:36:53

his.descriptionDiv.innerHTML=maxSize>0?string.substitute(nls[0],[getItemTitle(),maxSize , S.startIdx + 1, s.endIdx + 1]): “0” + getItemTitle();

【Talk】RIAStudio(228456440) 18:37:04

this.descriptionDiv.innerHTML = maxSize> 0? string.substitute(nls[0], [getItemTitle(), maxSize, s.startIdx + 1, s.endIdx + 1]):” 0″+getItemTitle();

【Talk】RIAStudio(228456440) 18:37:08

mainly this< /span>

【話唠】RIAStudio(228456440) 18:37:17

string.subst itute(nls[0],

【Talk】RIAStudio(228456440) 18:37:37

[getItemTitle(),maxSize, s.startIdx + 1, s.endIdx + 1]
These are the 4 parameters
< /span>

【Legend】JOY PB(529058939) 18:39:53

_updateDescription seems to be missing in the document

【Talk】RIAStudio(228456440) 18:40:07

this Is a private method

【Talk】RIAStudio(228456440) 18:40:15

By the way, don’t look at the document, just look at it Code

【 Legend] JOY PB(529058939) 18:40:38

Well, look at the code later

【Talk】RIAStudio(228456440) 18:40:39 div>
Reload it with extend

【Legend】JOY PB(529058939) 18:41:42

will not extend

【Legend】JOY PB(529058939) 18:41:57

I just learned to create class

【Talk】RIAStudio(228456440) 18:42:00

< /div>

【Legend】JOY PB(529058939 ) 18:42:06

< span style="font-family:Tahoma">

【Talk】RIAStudio(228456440) 18:42:30

When you learn it, you can realize that dojo is really the best js framework

【Legend】JOY PB(529058939) 18:43:28
Teach some more, how to extend

【Talk】RIAStudio(228456440) 18:44:54 div>
require([“dojox\grid\enhanced\nls\zh\Pagination”], function(Pagination){ Pagination.extend( {_updateDescription: function(){ // summary: // Update size information. var s = this.plugin.forcePageStoreLayer, maxSize = this.plugin._maxSize, nls = this.plugin._nls, getItemTitle = function(){ return maxSize <= 0|| maxSize== 1? nls[5]: nls[4]; }; if(this.description&& this.descriptionDiv){ this.descriptionDiv.innerHTML=maxSize> 0? string.substitute(nls[0 ], [getItemTitle(), maxSize, s.startIdx + 1, s.endIdx + 1]): “0” + getItemTitle();} }, }); });

The paging of the grid, or a separate paging

< span style="font-family:Tahoma">

【Legend】JOY PB(529058939) 18:24:29

p>

[Legend] JOY PB(529058939) 18:24:29

enhancedGrid paging

【Legend】JOY PB(529058939) 18:25:11

【Legend】JOY PB(529058939) 18:25:11

< span style="color:000000; font-size:10pt; font-family:Microsoft Yahei,'MS Sans Serif',sans-serif">The description information in the lower left corner, which is the information on the first few pages, How to modify it?

【话Chat】RIAStudio(228456440) 18:26:29

【Talk】RIAStudio(228456440) 18:26:29

display css or what

【Legend】JOY PB(529058939) 18:26:50

【Legend 】JOY PB(529058939) 18:26:50

Wait, let me take a screenshot

【Talk】RIAStudio(228456440) 18:26:52

【Talk】RIAStudio(228456440) 18:26:52

css, directly load a own css file

【Legend】JOY PB(529058939) 18:27:11

【Legend】JOY PB(529058939) 18:27:11

not css, but the template content inside

【Legend】JOY PB(529058939) 18:28:02

【Legend】JOY PB(529058939) 18:28:02< /p >

【話唠】RIAStudio(228456440 ) 18:28:17

【Talk】RIAStudio(228456440) 18:28:17

never used

【Legend】JOY PB(529058939) 18:28:24

【Legend】JOY PB(529058939) 18 :28:24

dojox\grid\enhanced \nls\zh\Pagination.js under this file

【Talk】RIAStudio(228456440) 18:28:44

【Talk】RIAStudio(228456440) 18:28:44

< span style="color:000000; font-size:10pt; font-family: Microsoft Yahei,'MS Sans Serif', sans-serif">This is a string template

【Legend】JOY PB(529058939) 1 8:28:48

 

【传说】JOY PB(529058939) 18:28:48

你要告诉我,你没用过dijit么。 . .

【话唠】RIAStudio(228456440) 18:28:53

 

【话唠】RIAStudio(228456440) 18:28:53

有4个参数

【传说】JOY PB(529058939) 18:28:59

 

【传说】JOY PB(529058939) 18:28:59

你全是自己写的。 . .

【话唠】RIAStudio(228456440) 18:29:05

 

【话唠】RIAStudio(228456440) 18:29:05

这是它自己的,不是通用的

【传说】JOY PB(529058939) 18:29:32

 

【传说】JOY PB(529058939) 18:29:32

能修改没

【话唠】RIAStudio(228456440) 18:29:52

 

【话唠】RIAStudio(228456440) 18:29:52

这4个参数分表代表的是什么,可以搜索 descTemplate 找一下在哪里匹配的

【话唠】RIAStudio(22845644 0) 18:30:00

 

【话唠】RIAStudio(228456440) 18:30:00

肯定可以改

【话唠】RIAStudio(228456440) 18:30:22

 

【话唠】RIAStudio(228456440) 18:30:22

不过要通过重载来修改,最好不要直接改原控件

【传说】JOY PB(529058939) 18:30:45

 

【传说】JOY PB(529058939) 18:30:45

【传说】JOY PB(529058939) 18:31:07

 

【传说】JOY PB(529058939) 18:31:07

enhancedGrid的pagination插件里面有nls

【话唠】RIAStudio(228456440) 18:31:23

 

【话唠】RIAStudio(228456440) 18:31:23

nls 是多国语言,跟这个没关系

【传说】JOY PB(529058939) 18:31:31

 

【传说】JOY PB(529058939) 18:31:31

是啊,我也不想修改他的源文件

【话唠】RIAStudio(228456440) 18:32:03

 

【话唠】RIAStudio(228456440) 18:32:03

等下,帮你找一下

【传说】JOY PB(529058939) 18:32:07

 

【传说】JOY PB(529058939) 18:32:07

【传说】JOY PB(529058939) 18:32:24

 

【传说】JOY PB(529058939) 18:32:24

这是它里面的调用

【话唠】RIAStudio(228456440) 18:36:38

 

【话唠】RIAStudio(228456440) 18:36:38

dojox\grid\enhanced\nls\zh\Pagination.js这个文件的399行

_updateDescription: function(){
// summary:
// Update size information.
var s = this.plugin.forcePageStoreLayer,
maxSize = this.plugin._maxSize,
nls = this.plugin._nls,
getItemTitle = function(){
return maxSize <= 0 || maxSize == 1 ? nls[5] : nls[4];
};
if(this.description && this.descriptionDiv){
this.descriptionDiv.innerHTML = maxSize > 0 ? string.substitute(nls[0], [getItem Title(), maxSize, s.startIdx + 1, s.endIdx + 1]) : “0 ” + getItemTitle();
}
},
重载这个方法

【话唠】RIAStudio(228456440) 18:36:53

 

【话唠】RIAStudio(228456440) 18:36:53

his.descriptionDiv.innerHTML = maxSize > 0 ? string.substitute(nls[0], [getItemTitle(), maxSize, s.startIdx + 1, s.endIdx + 1]) : “0 ” + getItemTitle();

【话唠】RIAStudio(228456440) 18:37:04

 

【话唠】RIAStudio(228456440) 18:37:04

this.descriptionDiv.innerHTML = maxSize > 0 ? string.substitute(nls[0], [getItemTitle(), maxSize, s.startIdx + 1, s.endIdx + 1]) : “0 ” + getItemTitle();

【话唠】RIAStudio(228456440) 18:37:08

 

【话唠】RIAStudio(228456440) 18:37:08

主要是这个

【话唠】RIAStudio(228456440) 18:37:17

 

【话唠】RIAStudio(228456440) 18:37:17

string.substitute(nls[0],

【话唠】RIAStudio(228456440) 18:37:37

 

【话唠】RIAStudio(228456440) 18:37:37

[getItemTitle(), maxSize, s.startIdx + 1, s.endIdx + 1]
这就是那4个参数

【传说】JOY PB(529058939) 18:39:53

 

【传说】JOY PB(529058939) 18:39:53

_updateDescription这个貌似文档里面没有

【话唠】RIAStudio(228456440) 18:40:07

 

【话唠】RIAStudio(228456440) 18:40:07

这是私有方法

【话唠】RIAStudio(228456440) 18:40:15

 

【话唠】RIAStudio(228456440) 18:40:15

说了,不要看文档,直接看代码

【传说】JOY PB(529058939) 18:40:38

 

【传说】JOY PB(529058939) 18:40:38

嗯,以后看代码

【话唠】RIAStudio(228456440) 18:40:39

 

【话唠】RIAStudio(228456440) 18:40:39

用 extend 重载一下就可以了

【传说】JOY PB(529058939) 18:41:42

 

【传说】JOY PB(529058939) 18:41:42

不会extend

【传说】JOY PB(529058939) 18:41:57

 

【传说】JOY PB(529058939) 18:41:57

我刚学会create class

【话唠】RIAStudio(228456440) 18:42:00

 

【话唠】RIAStudio(228456440) 18:42:00

【传说】JOY PB(529058939) 18:42:06

 

【传说】JOY PB(529058939) 18:42:06

【话唠】RIAStudio(228456440) 18:42:30

 

【话唠】RIAStudio(228456440) 18:42:30

等你学会了,就能体会到 dojo 真的是最好的 js 框架

【传说】JOY PB(529058939) 18:43:28

 

【传说】JOY PB(5290 58939) 18:43:28

再教点吧,怎么extend

【话唠】RIAStudio(228456440) 18:44:54

 

【话唠】RIAStudio(228456440) 18:44:54

require([“dojox\grid\enhanced\nls\zh\Pagination”], function(Pagination){   Pagination.extend({ _updateDescription: function(){ // summary: // Update size information. var s = this.plugin.forcePageStoreLayer, maxSize = this.plugin._maxSize, nls = this.plugin._nls, getItemTitle = function(){ return maxSize <= 0 || maxSize == 1 ? nls[5] : nls[4]; }; if(this.description && this.descriptionDiv){ this.descriptionDiv.innerHTML = maxSize > 0 ? string.substitute(nls[0], [getItemTitle(), maxSize, s.startIdx + 1, s.endIdx + 1]) : “0 ” + getItemTitle(); } },   }); });

Leave a Comment

Your email address will not be published.