Announcement

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

    #16
    Can you tell me where I can get access to the nightly builds please?

    Comment


      #17
      I have been thinking of a way to facilitate inline editing for the FileItem type. I declared a class in the following way

      Code:
      isc.ClassFactory.defineClass( "CustomBinaryEditor", FileItem );
      
      isc.CustomBinaryEditor.addProperties
      (
      	{
      		transformInput:
      			function( form, item, value, oldValue )
      			{
      				return this.Super( "transformInput", arguments );
      			}
      	}
      );
      and then override ListGrid.getEditorType to return this custom class but unfortunately transformInput isn't invoked after a file is selected in the dialog. I also tried handling change and changed but never managed to see the newly selected value.

      Should this be possible or do you have another suggestion? Also, could you give me a pointer regarding the nightly builds or reply with the example to which you referred in your post yesterday please?

      Comment


        #18
        Not going to be possible. Bear in mind there are security constraints as far as what you can do with uploads - you can't change the value because this would give you access to any file on the user's disk, and some browsers won't even given you the full path.

        Nightlies are in the FAQ.

        Comment


          #19
          Originally posted by Isomorphic
          Nightlies are in the FAQ.
          The only nightlies I could find were here: http://forums.smartclient.com/showthread.php?t=3030 but they seem to relate to SmartGWT and not the regular non-GWT version.

          If this is the correct FAQ can you give me an indication of roughly where the sample can be found, and if not can you point me in the right direction please?
          Last edited by somewhereinbelgium; 11 May 2010, 00:41.

          Comment


            #20
            It's all in the same location regardless of what edition you're using: smartclient.com/builds.

            Comment


              #21
              Thanks for your excellent help to date. I now have my binary data coming over to the server side, but when DSRequest.parseUploadedFiles() is invoked, the attempt to retrieve the datasource given the data source name (which is dynamically generated for uniqueness reasons) fails, i.e. the variable

              Code:
              DataSource ds = DataSourceManager.getDataSource( getDataSourceName() );
              has the value null. I therefore get a NullPointerException when trying to retrieve the DSField even though the fieldName variable is correct.

              Therefore the question is, do I need to register the name for my dynamically generated DataSource instance with DataSourceManager and if so, how? I don't see much of a public interface on this class, although I can see that it seems to be a proxy for a PoolManager instance.

              Any guidance here would be gratefully received.

              Comment


                #22
                For any such failure, always post the stack trace you're seeing, as well as surrounding code (not just a single line).

                Comment


                  #23
                  Originally posted by Isomorphic
                  For any such failure, always post the stack trace you're seeing, as well as surrounding code (not just a single line).
                  Mmm, if you could just throw me a hint as to whether it is normally necessary to register a datasource with some manager class when they are dynamically generated this would help greatly.

                  Comment


                    #24
                    Here are images showing the call stack and contents of the variable window when debugging on the server side. You will notice that the variable ds (type DataSource) is null and therefore the attempt to retrieve the DSField instance for the field whose name is 'picture' will fail.

                    So the question remains: do I need to register my dynamically generated datasource?
                    Attached Files

                    Comment


                      #25
                      There isn't a registration API, so in essence, you can't currently upload to a dynamically generated DataSource. However you can have a DataSource that actually exists as a .ds.xml file, target that DataSource with the upload and actually commit the data to a dynamically generated DataSource.

                      If that doesn't sound feasible, then start with the very big picture - why, in terms of requirements for your application and what the end users are doing, did you choose to build DataSources dynamically and upload to them.

                      Comment


                        #26
                        Originally posted by Isomorphic
                        why, in terms of requirements for your application and what the end users are doing, did you choose to build DataSources dynamically and upload to them.
                        In essence, because I don't want to have to write a data source definition manually (=repetitively) for every potential table in the database that the user will need to maintain.

                        This way I can write one jsp which allows the user to maintain data for any table in a consistent and uniform manner.

                        Editing of all other data is now complete and uploading of binary files is the only outstanding issue.

                        Comment


                          #27
                          For your use case, it's probably sufficient to just also save the DataSource to disk as a .ds.xml file the first time it's generated.

                          Comment


                            #28
                            The uploading of binary files to the server is now completed without the need to manually write a .ds.xml file when the datasource is created.

                            I have achieved this by handling the request at a very early stage as in the following snippet:

                            Code:
                            @Override
                            public void service( final ServletRequest servletRequest, final ServletResponse servletResponse ) throws ServletException, IOException
                            {
                            	boolean processed = false;
                            	try
                            	{
                            		final RequestContext context = RequestContext.instance( servletRequest, servletResponse );
                            		Map<?, ?> queryParamsMap = ServletTools.parseQueryString( context.request.getQueryString() );
                            		if ( queryParamsMap.get( "singleUpload" ) != null
                            and this allows me to obtain a reference to the ISCFileItem which comes from ISCHttpServletRequest.getFileParams().

                            Once the database update has occurred successfully I then set a response in the following manner:

                            Code:
                            if ( servletResponse instanceof HttpServletResponse )
                            {
                            	final HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
                            	httpServletResponse.setStatus( HttpServletResponse.SC_OK );
                            	response = new DSResponse( httpServletResponse );
                            	response.setAffectedRows( rowsAffected );
                            }
                            The problem I have is that the client never receives a confirmation that the operation has been completed, so I assume that I'm either not setting the status correctly or not completing some post processing logic. As a result the dialog saying 'Saving Form' is continually displayed.

                            Could you offer some advice on what kind of logic I should write so that the client is informed that the update has occurred successfully?

                            Comment


                              #29
                              Solved

                              After some searching I discovered that it is possible to register a dynamically generated datasource, and this is achieved by a call to

                              Code:
                              DataStructCache.addCachedObjectWithNoConfigFile( "dataSourceName", ds );
                              So my question to Isomorphic is, could you not have given me a hint about this function as a response to my previous question other than

                              Originally posted by Isomorphic
                              For your use case, it's probably sufficient to just also save the DataSource to disk as a .ds.xml file the first time it's generated.
                              I really think your framework is fantastic and the odd tip like that would truly speed my progress greatly.

                              Comment


                                #30
                                Yes it would speed progress - progress in the wrong direction. What we're doing is pointing you to supported approaches. If you continue to try to find undocumented alternative approaches, that just means that after a lot of effort, you'll have something that breaks next time you upgrade.

                                Comment

                                Working...
                                X