Hide Edit in inline mode - List and library control

Hi is there any way we can hide edit button of inline as below.?
image

We just want to keep delete if possible.

Hello @Rinu,

To hide the edit option, please, add the following code to JavaScript editor:

fd.spRendered(function() {
    fd.control('SPDataTable1').ready().then(function(dt) {
        $($(dt.$el).find('.k-header')[1]).hide();
    });
});

And the following style to CSS editor:

.fd-command-cell{
    display: none!important;
}

Thanks Mnikitina,
This is not related to the above question but some what important.
We have a validation check to see if there is any record in the forms as below.

   if (fd.control("SPDataTable1").widget.dataItems().length == 0) {
	        this.error = "Add at least one asset to cart before submitting";
	        return false;
	    }   


Which works fine except, in List and library edit mode even if you dont click the tick as shown above the form will allow to submit as long as there are some values on the form. is there a work around for this?

@Rinu,

@noorshahida88,

You can add a custom validator that will check if control has unsaved lines. Please find the code below.

fd.validators.push({
    name: 'MyCustomValidator',
    error: "Please save rows",
    validate: function(value) {
        return fd.control('SPDataTable0').widget.element.find('.k-i-check').length==0;
    }
});
1 Like

Hello,

Can you please suggest how can I hide just the row save button in list or library control.

image

Hello @aseem,

What is your use case? How will users save changes to the row?

Hi Margo, it saves when the user clicks submit button. Also, looks like it saves the row after click New button as well.

image

@aseem,

You can hide it with CSS:

a.k-button.k-button-icontext.k-primary.k-grid-update {
    display: none
}

Thank you! I'll try it. One last question on list or library :slight_smile: I tried to use the code from here Lookup and people picker appears as a link in form - #5 by Vasilii_Burca to display user field value as text, but it is not working. Any suggestions?

@aseem,

Please share the code you are suing to remove the link

here is the code:

fd.control('ListOrLibrary1').templates = {
// LookupColumn is the column name
Name: function(ctx) {
var value = ctx.row.Name;
if (!value) {
return '';
}
return value.map(function(v) {
return v.lookupValue;
})
}
}

@aseem,

The Person or Group field value is an object with properties:

To display the name of the user without the link you need to replace lookupValue with title like so:

fd.control('ListOrLibrary1').templates = {
        // LookupColumn is the column name
        Name: function(ctx) {
            var value = ctx.row.Name;
            if (!value) {
                return '';
            }
            return value.map(function(v) {
                return v.title;
            })
        }