Question

do you have an idea how to ask the user to create a new object without specifying the ID? ie it to me to specify ID during the development! Indeed, it is not a form, I used the startEditingNew () function here is the code :

isc.ListGrid.create({
    ID: "AttributsList",
    width:"*", height:370,
    alternateRecordStyles:true,
    dataSource: crm_attributs,
    canReorderRecords: true,
    autodraw: false,
    selectionType :"single",
    autoFetchData: true,
    showFilterEditor: false,
    canEdit:true,
    listEndEditAction: "next",
    sortField : "crm_attr_order",
    canEdit: true,
    editEvent: "doubleClick",
    autoSaveEdits:true,
    initialCriteria: {crm_attr_fk_kind_idnum : 9999},
    fields: [ 
         {name:"crm_attr_fk_kind_idnum", title:"Kind", width:"50", canEdit:true,align:"left", disabled: false}
        , {name:"crm_attr_order", title:"Order" ,width:"50",showIf:"true",canEdit:true,align:"left"}
        ,{name:"crm_attr_name", title:"Name",width:"*" ,align:"left",canEdit:true}
        ,{name:"crm_attr_datatype", title:"Type" ,width:"40",showIf:"true",canEdit:true,align:"left"}
        ,{name:"crm_attr_datalist", title:"Datalist", width:"118", canEdit:true ,align:"left"}
        ,{name:"crm_attr_variable", title:"Variable", width:"118", canEdit:true,align:"left" }
        ,{name:"crm_attr_min", title:"Min", width:"40", canEdit:true ,align:"left"}
        ,{name:"crm_attr_max", title:"Max", width:"40", canEdit:true ,align:"left"}
    ],
    gridComponents:["header", "body", Attributes_EditList],
    dataChanged : function () {
                this.Super("dataChanged", arguments);
                var totalRows = this.data.getLength();
                if (totalRows > 0 && this.data.lengthIsKnown()) {
                totalsLabel.setContents(totalRows + " Attributs");
                } else {
                totalsLabel.setContents(" ");
    }
                            },
    emptyMessage: " Appuyez sur le bouton <b>'+' </b>pour ajouter un nouvel attribut   "

});


isc.ToolStrip.create({
    ID: "Attributes_EditList",
    autodraw: false,
    width: "100%", height:24, 
    members: [
           isc.ToolStripButton.create({
       icon: "[SKIN]/actions/add.png", 
       prompt: "add a new attribute",
       click:"AttributsList.startEditingNew()"
                                            })
                                ]
    });
Was it helpful?

Solution

I found the solution! I must use this function: ListGrid.setEditValue (rowNum, colNum, value)

Modifies a field value being tracked as an unsaved user edit. Use for suggested or reformatted values for edits that remain unsaved.

Parameters:

rowNum  - type: Number 
    Row number (or edit values ID)
colNum  - type: Number | String 
    Column number of cell, or name of field having editValue updated
 value  - type: any 
    New value for the appropriate field.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top