Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    bug when editing grid with binary field

    SmartClient Version: v10.0p_2015-05-20/Enterprise Development Only (built 2015-05-20)

    Chrome, Firefox on OSX

    Hello, please modify the #customBinaryField like this:
    Code:
    isc.DynamicForm.create({
        ID: "formView",
        width: "100%",
        dataSource: customBinaryField,
        fields: [
           	{name: "id", width: 150, canEdit:false},
        	{name: "file", canEdit:false}
        ]
    });
    
    isc.DynamicForm.create({
        ID: "formEdit",
        width: 100,
        dataSource: customBinaryField,
        fields: [
            {name: "id", width: 150, required: true},
            {name: "file", required: true}
        ]
    });
    
    isc.IButton.create({
        ID: "uploadButton",
        title: "Upload",
        width: 100,
        click: function(){
            formEdit.saveData("if(dsResponse.status>=0) formEdit.editNewRecord()");
        }
    });
    
    isc.VLayout.create({
        ID: "vLayoutForms",
        width: 100,
        members: [
            isc.Label.create({
                contents: "Editor",
                width: 50,
                height: 25,
                autoDraw: true,
                baseStyle: "exampleSeparator"
            }),
            formEdit,
            uploadButton,
            isc.Label.create({
                contents: "View",
                width: 50,
                height: 25,
                autoDraw: true,
                baseStyle: "exampleSeparator"
            }),
            formView
        ]
    });
    
    isc.ListGrid.create({
        ID: "listGrid",
        width:500, height:224, alternateRecordStyles:true,
        dataSource: customBinaryField,
        selectionType: "single",
        autoFetchData: true,
        fields:[
            {name:"id", width:100, canEdit:true},
            {name:"file", width:380, canEdit:false}
        ],
        recordClick: function(viewer, record, recordNum, field, fieldNum, value, rawValue) { 
            formEdit.editSelectedData(listGrid);
            formView.editSelectedData(listGrid);
        }
    });
    
    isc.HLayout.create({
        ID: "hLayoutTop",
        width: 700,
        layoutMargin:10,
        membersMargin: 10,
        members:[listGrid, vLayoutForms]
    });
    
    isc.Button.create({
        ID: "buttonDownload",
        width:200,
        title: "Download Selected File",
        click: function () { 
            var selectedRecord = listGrid.getSelectedRecord();
            if (selectedRecord == null) {
                isc.say("You must select one record");
                return;
            }
            customBinaryField.downloadFile(selectedRecord);
        }
    });
    
    isc.Button.create({
        ID: "buttonView",
        width:200,
        title: "View Selected File",
        click: function () { 
            var selectedRecord = listGrid.getSelectedRecord();
            if (selectedRecord == null) {
                isc.say("You must select one record");
                return;
            }
            customBinaryField.viewFile(selectedRecord);
        }
    });
    
    
    isc.HLayout.create({
        ID: "hLayoutButtons",
        width: 500,
        layoutMargin: 10,
        membersMargin: 10,
        members: [buttonDownload, buttonView]
    });
    
    isc.VLayout.create({
        ID: "vLayout",
        width: 300,
        members: [hLayoutTop, hLayoutButtons]
    });
    Actually I've just modified the listGrid fields like this:
    Code:
    fields:[
            {name:"id", width:100, canEdit:true},
            {name:"file", width:380, canEdit:false}
        ],
    If you doubleClick a row, you'll see that the filename for that row appears on the gridBody, in the top-left corner.

    #2
    By the way I noticed that if I set canEdit:true on the "file" field, it seems to permit choosing the file to upload without using the external form, but then the upload fails. Is it supported usage or a bug?

    Comment


      #3
      On your question from your second post: no, inline editing of binary fields isn't allowed since the grid needs to redraw it's DOM in lots of circumstances, and there's no cross-browser way to maintain access to the file the end user has chosen. So editing view an external form is required.

      We'll get back to you on the misplaced text.

      Comment


        #4
        You should find this to be fixed in builds dated May 27 and later.

        Comment

        Working...
        X