Skip to content

Commit 20aaf88

Browse files
committed
feat(simple/column setup): option to disable the custom attributes the grid adds in simple and column setup, and option to add observer to just the current entity
1 parent b88d88f commit 20aaf88

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

src/vGrid/v-grid-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export class VGridConfig {
7474
this.attHidePagerInfo = false;
7575
this.attCustomPager = null;
7676
this.attLanguage = {};
77+
this.attOnlyCustom = false; //to stop markup generator for adding attributes when in simple and column config
7778

7879
//repeat html vars
7980
this.repeater = false;

src/vGrid/v-grid-markup-generator.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,14 @@ export class VGridMarkupGenerator {
211211
let attributeRow = col.colAddRowAttributes ? col.colAddRowAttributes : '';
212212
let css = col.colCss ? `css="${col.colCss}"` : '';
213213

214+
let imageFix = "v-image-fix";
215+
if(this.vGrid.vGridConfig.attOnlyCustom){
216+
imageFix = "";
217+
}
218+
219+
214220
//insert the markup
215-
col.colRowTemplate = `<image ${css} ${classNames} v-image-fix ${attributeRow} src.bind="${col.colField}">`;
221+
col.colRowTemplate = `<image ${css} ${classNames} ${imageFix} ${attributeRow} src.bind="${col.colField}">`;
216222

217223
}
218224

@@ -236,6 +242,9 @@ export class VGridMarkupGenerator {
236242

237243
//attibute observer for 2 way flow between row and current entity
238244
let attributeObserver = `v-observe-field="${this.getAttribute(col.colField)}"`;
245+
if(this.vGrid.vGridConfig.attOnlyCustom){
246+
attributeObserver = "";
247+
}
239248

240249
//is it a checkbox?
241250
//todo: adding the observer part without choice, maybe param for that?
@@ -301,9 +310,15 @@ export class VGridMarkupGenerator {
301310

302311
let sort = col.colSort ? `v-sort="${col.colSort}"` : '';
303312

313+
314+
let extraAttributes = "v-drag-drop-col v-resize-col";
315+
if(this.vGrid.vGridConfig.attOnlyCustom){
316+
extraAttributes = "";
317+
}
318+
304319
//apply magic
305320
//todo, atm Im adding resize columns and dragdrop columns, should this be a choice?
306-
let markup = `<p v-drag-drop-col v-resize-col ${classname} ${sort} ${colAddLabelAttributes}>${col.colHeaderName}</p>`;
321+
let markup = `<p ${extraAttributes} ${classname} ${sort} ${colAddLabelAttributes}>${col.colHeaderName}</p>`;
307322
//return the markup
308323
return markup;
309324
}

src/vGrid/v-grid.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export class VGrid {
3737
@bindable({attribute: "v-hide-pager-info"}) attHidePagerInfo;
3838
@bindable({attribute: "v-custom-pager"}) attCustomPager;
3939
@bindable({attribute: "v-language"}) attLanguage;
40+
@bindable({attribute: "v-only-custom"}) attOnlyCustom;
41+
@bindable({attribute: "v-attribute-observe"}) attAttributeObserve;
4042
@bindable loadingMessage = "Working please wait";
4143
loading = false;
4244

@@ -210,6 +212,8 @@ export class VGrid {
210212
vConfig.setBindValueFunction(this.eventOnRemoteCall, 'eventOnRemoteCall');
211213
vConfig.setBindValueBool(this.attHidePagerInfo, 'attHidePagerInfo');
212214
vConfig.setBindValueString(this.attCustomPager, 'attCustomPager');
215+
vConfig.setBindValueBool(this.attOnlyCustom, 'attOnlyCustom');
216+
213217
this.vGridConfig.attLanguage = this.attLanguage || this.vGridConfig.attLanguage;
214218

215219

0 commit comments

Comments
 (0)