Quellcode durchsuchen

getRowClass to scopeFn

luoyifan vor 3 Jahren
Ursprung
Commit
d8e8b0ef41
1 geänderte Dateien mit 12 neuen und 2 gelöschten Zeilen
  1. 12 2
      src/controls/grid.js

+ 12 - 2
src/controls/grid.js

@@ -29,8 +29,20 @@ export default function () {
 
             }, baseConfig(config, 'row-item'), config, grid)
 
+            // 在面板上的组件
+            const scope = newConfig.$initParent.yvanScope || newConfig.$initParent.lookupReferenceHolder().yvanScope;
+
             const buttons = []
 
+            const {getRowClass} = newConfig
+            if (typeof getRowClass === 'string' && (
+                _.startsWith(getRowClass, "scope.") ||
+                _.startsWith(getRowClass, "system."))
+            ) {
+                const fn = lookupFn(scope, getRowClass)
+                _.set(newConfig, 'viewConfig.getRowClass', fn)
+            }
+
             if (!newConfig.hideExport) {
                 buttons.push({
                     xtype: 'button',
@@ -109,8 +121,6 @@ export default function () {
                     _.startsWith(renderer, "system."))
                 ) {
                     if (newConfig.$initParent) {
-                        // 在面板上的组件
-                        const scope = newConfig.$initParent.yvanScope || newConfig.$initParent.lookupReferenceHolder().yvanScope;
                         if (scope) {
                             const rendererFn = lookupFn(scope, renderer)
                             c.renderer = rendererFn