Announcement

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

    ListGrid disabled record problems

    I give up. I've been messing with this all day and can't make it work, so I'm coming to the forum. I've looked over many posts here, as I know this is a popular topic, but I just can't figure out how to make it work.

    The objective is simple, I want to use the selectionAppearance:"checkbox" on my listGrid. Some rows the user is not subscribed to, so those rows should not be selectable. listGrid.findAll("continent", "Europe").setProperty("enabled", false); would have been a handy solution, but this listGrid does not use a datasource. Instead, it uses and RPC call. I've tried just about every thing I can think of, but nothing works. Can someone provide some direction? Thanks, S (using 7.0rc)

    Code:
    	isc.ListGrid.create({
    	    ID: "qsSearchResults",
    	    loadingDataMessage:"Searching...",
    		width:820,
    		bodyBackgroundColor:"#FFFFFF",
    		alternateRecordStyles:true,
    		selectionAppearance:"checkbox",
    	    height:700,
    	    top:130,
    	    left:160,
    	    fields:[
    				{name:"subscribed", ID:"subscribed", title:" ", width:25, type:"boolean", prompt:"Subscription required", showIf:"false"},
    				{name:"company_code_dis", title:"Co Code", width:60, prompt:"Company code"},
    				{name:"stmt", title:"Type", width:50, prompt:"Insurance type"},
    	            {name:"company_name", title:"Company Name", width:150, prompt:"Company name", showHover:true,  hoverHTML:"return (record.subscribed)?record.company_name:'Subscription required'"},
    	            {name:"ticker", title:"Ticker", width:45, prompt:"Ticker symbol"},
    	            {name:"group_name", title:"Group Name", width:150, prompt:"Group name", showHover:true},
    	            //{name:"group_code", title:"Grp Code", width:50, prompt:"Group code"},
    	            {name:"state_of_domicile", title:"State", width:40, prompt:"State of domicile"},
    	            {name:"annual_assets", title:"Annual Assets", width:100, type:"integer", prompt:"Annual Assets", formatCellValue:"isc.Format.toUSString(value)"},
    	            {name:"annual_dpw", title:"Annual DPW", width:100, type:"integer", prompt:"Annual direct premiums written", formatCellValue:"isc.Format.toUSString(value)"},
    	            {name:"data_as_of", title:"Data as of", width:80, type:"date", prompt:"Date this information was last updated"}
    	           ],
    		autoDraw:false
    	});
    Code:
    function quickSearch(value) {
    	var keyword = value;
        isc.RPCManager.sendRequest({
    		containsCredentials: false,
    		actionURL:"/iap/nsGQSFind.go",
    		useSimpleHttp: false,
    		timeoutErrorMessage:"Operation timed out. Please try again.",
    		prompt:"Searching...",
    		showPrompt: true,
    	    willHandleError:false,
    	    params : {
    	       queryString: keyword
    	    },
    	    callback : "displayResults(rpcResponse)"
        });
    }
    
    function displayResults(rpcResponse) {
        var status = rpcResponse.status;
        switch(status)
        {
        	case 0: //Search successful and results are there
        		qsSearchResults.setData(rpcResponse.data.resultList);
        		break;
        	case 1: //Search successful but 0 results
        		isc.warn(rpcResponse.data.errorMessage);
        		break;
        	case 2: //Search successful and Max result count reached
        		isc.warn(rpcResponse.data.errorMessage);
        		break;
        	case 3: //Error
        		isc.warn(rpcResponse.data.errorMessage);
        		break;
        	default:
    			isc.warn("Unknown error occured while searching. Please close this window and try again.");
        }
        qsSearchResults.show();
    }

    #2
    You can use the recordCanSelectProperty directly on your records. This defaults to "canSelect" meaning if you have any records with canSelect set to false you will not be able to select them in your grid.

    Or of course you could set the recordEnabledProperty (defaults to "enabled") to false on your records if you also want disabled appearance / no other interactions on those rows.

    If the difficulty is getting at the records to determine where to apply this property - you can use List APIs directly on your array of results of course -- so something like rpcResponse.data.resultList.findAll("foo", "moo");

    Comment


      #3
      That worked perfectly, thanks! I must have tried everything, EXCEPT that particular method.

      There is one other issue, which I don't think there is a solution for but I'll ask anyway. When using selectionAppearance:"checkbox", there doesn't seem go be any way to label the header, put a prompt on the header or put a prompt on the checkbox. So, there's no way to label it to show the user what the checkbox is for, or that if they check the box at the top it selects all. I know the argument is "they'll know what to do" but that won't fly with folks around here.

      Is there any way to label the checkboxes, or is that just how it works?

      Comment


        #4
        You can specify 'checkboxFieldDefaults' as an object to customize the checkbox field -- meaning you could set its prompt (shows on header hover) or set showHover to true and specify a hoverHTML method returning HTML to show when the user hovers over cells...

        Comment


          #5
          Sorry - 'checkboxFieldProperties' rather than checkboxFieldDefaults is better

          Comment

          Working...
          X