1. #151
    Sencha User emredagli's Avatar
    Join Date
    Jun 2008
    Posts
    296
    Vote Rating
    0
    emredagli is on a distinguished road

      0  

    Default


    Hii stevenhzj,
    Firstly welcome to ExtJS world.
    You said "store.data.length = 0", you should use getCount() method of store.
    since "data" is config params.

  2. #152
    Sencha User
    Join Date
    Feb 2009
    Posts
    13
    Vote Rating
    0
    stevenhzj is on a distinguished road

      0  

    Default


    hi emredagli
    ye i use getCount() is also 0.
    the store is through asynchronous get. so in store.load(), use getCount() is 0,
    can i use callback to getCount() ? how to do? THK!

  3. #153
    Sencha User emredagli's Avatar
    Join Date
    Jun 2008
    Posts
    296
    Vote Rating
    0
    emredagli is on a distinguished road

      0  

    Default


    Mr. stevenhzj,
    It is better to send your code.
    It is hard to say what you sholud do without knowing what you are trying to do.

  4. #154
    Sencha User
    Join Date
    Feb 2009
    Posts
    13
    Vote Rating
    0
    stevenhzj is on a distinguished road

      0  

    Default


    hi emredagli

    this the button code:
    Code:
        buttons: [{
       id: 'grid-excel-button',
       text: 'Export to Excel...',
       handler: function(){
            var max = store.getCount();
            var downstore = new Ext.data.Store({ 
                        url: 'http://localhost/ExtTestWebService/Service_Test.asmx/GetArticles', // Web Service Site
                        reader: new Ext.data.XmlReader(
                        {
                        totalRecords: 'totalRecords', 
                        record: 'record', 
                        id: 'id' 
                        },
                        [
                        {name: 'id'},
                        {name: 'name'},
                        {name: 'code'},
                        {name: 'joindate'}
                        ]
                        ),
                        remoteSort: true //                     });
                        
                        downstore.on('beforeload', function(downstore) { 
                          downstore.baseParams={consql:v_consql};
                          } );
                         
                        downstore.load({params:{start:0,limit:max}}); //                     
            vExportContent = grid.getExcelXml(store.data,false);
            exportExcell();
       }
      }],
    another WebService Code:
    Code:
        [WebMethod]
        public DataSet GetArticles(string consql, int start, int limit, string sort, string dir)
        {
            DataSet ds = new DataSet("Operator");
    
            string strSql = string.Format(
    "select top {0} * from sys$vw_operator where 1=1 " + consql + "  and  Id not in (select top {1} Id from sys$vw_operator order by {2} {3}) order by {2} {3}",
    limit, start, sort, dir);
     
            SqlDataAdapter da = new SqlDataAdapter(strSql, _strConn);
            DataTable dtRecord = new DataTable("record");
            lock (da)
            {
                da.Fill(dtRecord);
            }
            ds.Tables.Add(dtRecord);
            DataTable dtResult = new DataTable("results");
            dtResult.Columns.Add("totalRecords");
            DataRow dr = dtResult.NewRow();
            using (SqlConnection conn = new SqlConnection(_strConn))
            using (SqlCommand cmd = new SqlCommand("select count(*) from sys$vw_operator where 1=1" + consql, conn))
            {
                try
                {
                    conn.Open();
                    dr["totalRecords"] = (int)cmd.ExecuteScalar();
                }
                catch
                {
                    // do nothing
                }
            }
            dtResult.Rows.Add(dr);
            ds.Tables.Add(dtResult);
            return ds;
        }
    Last edited by mystix; 21 Feb 2009 at 8:14 PM. Reason: post code in [code][/code] tags. see http://extjs.com/forum/misc.php?do=bbcode#code

  5. #155
    Sencha User
    Join Date
    Feb 2009
    Posts
    13
    Vote Rating
    0
    stevenhzj is on a distinguished road

      0  

    Default


    and i want know how use ext and ajaxpro2, i trying to use ,but then conflict.
    in Ajaxpro, js code is easy call function c# mothod, i to bo used to.
    but i can use in ext, anybody can help me , hope Demo Sample, Ths.

  6. #156
    Ext User
    Join Date
    Jul 2007
    Posts
    48
    Vote Rating
    0
    rakesh is on a distinguished road

      0  

    Default


    This Code may be helpful to generate excel file on server side.
    Code:
    public void generateExcelFile(List<? extends EkaListingDO> listingResults,
    			HttpServletResponse response, HttpServletRequest request,
    			String gridName) throws SystemException {
    
    		IUserContext userContext = this.getUserContext(request);
    
    		try {
    
    			String fileName = gridName + "-"
    					+ EkaDateUtil.getTimeStamp(new Date());
    
    			String dependentObj = (String) request.getParameter("dependentObj");
    
    			JSONObject jsonDependentObj = null;
    
    			if (EkaStringUtil.isNotEmpty(dependentObj)) {
    				jsonDependentObj = JSONObject.fromObject(dependentObj);
    			}
    
    			String columnModelState = (String) request
    					.getParameter("columnModelState");
    
    			columnModelState = columnModelState.replaceAll(
    					"EKA_INTERNAL_ID_AMP", "&");
    			columnModelState = columnModelState.replaceAll(
    					"EKA_INTERNAL_ID_HASH", "#");
    
    			OutputStream out = null;
    
    			response.setContentType("application/vnd.ms-excel");
    			response.setHeader("Content-Disposition", "attachment; filename="
    					+ fileName + ".xls");
    			WritableWorkbook w = Workbook.createWorkbook(response
    					.getOutputStream());
    			WritableSheet s = w.createSheet(gridName, 0);
    
    			JSONArray array = JSONArray.fromObject(columnModelState);
    
    			List<String> listProperties = new ArrayList<String>();
    
    			for (int i = 0; i < array.size(); i++) {
    
    				JSONObject object = (JSONObject) array.get(i);
    
    				listProperties.add(object.getString("dataIndex"));
    
    				s.addCell(new Label(i, 0, object.getString("header")));
    
    			}
    
    			String value = null;
    
    			if (!listProperties.isEmpty()) {
    
    				for (int i = 0; i < listingResults.size(); i++) {
    					EkaListingDO ekaListingDO = (EkaListingDO) listingResults
    							.get(i);
    
    					for (int j = 0; j < listProperties.size(); j++) {
    
    						value = (String) EkaBeanUtil.getBeanProperties(
    								ekaListingDO, listProperties.get(j));
    
    						if (EkaStringUtil.isNullOrEmpty(value)) {
    							value = "";
    						}
    
    						if (jsonDependentObj != null
    								&& jsonDependentObj.containsKey(listProperties
    										.get(j))) {
    							JSONArray array2 = (JSONArray) jsonDependentObj
    									.get(listProperties.get(j));
    
    							for (int k = 0; k < array2.size(); k++) {
    								JSONObject innObj = array2.getJSONObject(k);
    
    								String property = innObj.getString("dependsOn");
    								String separator = innObj
    										.getString("separator");
    
    								String dependentValue = (String) EkaBeanUtil
    										.getBeanProperties(ekaListingDO,
    												property);
    
    								if (EkaStringUtil.isNullOrEmpty(dependentValue)) {
    									dependentValue = "";
    								}
    								if (EkaStringUtil.isNotEmpty(value)) {
    									value = value + separator + dependentValue;
    								}
    
    							}
    
    						}
    
    						if (EkaStringUtil.isDoubleContent(value)
    								|| EkaStringUtil.isOnlyNumericContent(value)) {
    							s.addCell(new Number(j, i + 1, EkaStringUtil
    									.convertStringToDouble(value)));
    						} else {
    							s.addCell(new Label(j, i + 1, value));
    						}
    
    					}
    				}
    			}
    
    			w.write();
    			w.close();
    
    			if (out != null) {
    				out.close();
    
    			}
    
    		} catch (Exception e) {
    			logger.error(userContext, e);
    		}
    
    	}
    Last edited by mystix; 22 Feb 2009 at 10:51 AM. Reason: it might be useful if it was readable... post code in [code][/code] tags. see http://extjs.com/forum/misc.php?do=bbcode#code

  7. #157
    Ext JS Premium Member NoahK17's Avatar
    Join Date
    Apr 2008
    Location
    Atlanta, GA
    Posts
    518
    Vote Rating
    1
    NoahK17 is on a distinguished road

      0  

    Default


    As an update to my previous issue with OpenOffice vs. MS Excel -- having MS Excel installed worked like a charm opening the generated XLS file. Sorry OpenOffice, you lose this round!
    Noah
    Senior Web Developer
    NBA.com

  8. #158
    Ext User
    Join Date
    Mar 2009
    Posts
    2
    Vote Rating
    0
    hardc0re is on a distinguished road

      0  

    Default


    bad post
    Last edited by hardc0re; 16 Mar 2009 at 1:28 AM. Reason: USE CODE TAGS!!!!!!!!!!!!!!

  9. #159
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,483
    Vote Rating
    35
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    So you didn't' read the message, and try to find the mistake then? You just blurted your bug here.

    READ the XML section which the error message kindly tells you about, and you see

    Code:
     <Worksheet ss:Name=". la 31.12.2008.xls]Contracte valide si in vigoare">
    Excel seems not to like that.

    READ the free code which generates that section, and you see:

    Code:
    //      Generate worksheet header details.
            var t = '<ss:Worksheet ss:Name="' + this.title + '">' +
    Do some work.

  10. #160
    Ext User
    Join Date
    Mar 2009
    Posts
    2
    Vote Rating
    0
    hardc0re is on a distinguished road

      0  

    Default


    thanks i think i did it

Thread Participants: 140

  1. alexb (1 Post)
  2. galdaka (3 Posts)
  3. ghyster (1 Post)
  4. Condor (1 Post)
  5. TopKatz (1 Post)
  6. Jul (1 Post)
  7. mystix (3 Posts)
  8. Foggy (2 Posts)
  9. bloon (1 Post)
  10. fshort (1 Post)
  11. antimatter15 (1 Post)
  12. cocinerox (1 Post)
  13. tobiu (1 Post)
  14. ajaxE (2 Posts)
  15. andreyz (1 Post)
  16. devnull (4 Posts)
  17. mjlecomte (4 Posts)
  18. kevinwu8 (1 Post)
  19. rakesh (1 Post)
  20. hendricd (2 Posts)
  21. gelleneu (1 Post)
  22. isaac (1 Post)
  23. huling (1 Post)
  24. ckr (1 Post)
  25. roopa (1 Post)
  26. loveyeah (1 Post)
  27. zhfxu_cs (1 Post)
  28. Mthor (1 Post)
  29. johnlicy (1 Post)
  30. thoreking (2 Posts)
  31. csqjean (1 Post)
  32. mankz (1 Post)
  33. vietschv (1 Post)
  34. verbi (1 Post)
  35. sanjshah (2 Posts)
  36. mask_hot (1 Post)
  37. calavera (1 Post)
  38. vsmike (1 Post)
  39. vizcano (1 Post)
  40. lakehouse (1 Post)
  41. alaska (2 Posts)
  42. radtad (3 Posts)
  43. jmcneese (1 Post)
  44. Rafael (4 Posts)
  45. calvouze (1 Post)
  46. Joyfulbob (1 Post)
  47. angeldimitrov (2 Posts)
  48. Jack_S (2 Posts)
  49. g13013 (2 Posts)
  50. DamienValentine (5 Posts)
  51. Marcelo Delgado (1 Post)
  52. NoahK17 (8 Posts)
  53. anujg (1 Post)
  54. aproust94 (3 Posts)
  55. pokerking400 (1 Post)
  56. Ronhead (1 Post)
  57. krzak (3 Posts)
  58. cvieira (1 Post)
  59. Efex (5 Posts)
  60. gthe (2 Posts)
  61. miihiir (2 Posts)
  62. pops (1 Post)
  63. emredagli (12 Posts)
  64. larsa (2 Posts)
  65. maggiesnyder (3 Posts)
  66. sam.zhang (1 Post)
  67. kristalgic (1 Post)
  68. wiznia (3 Posts)
  69. frpucci (1 Post)
  70. tinakonda (1 Post)
  71. tBSTAR (1 Post)
  72. tdg2008 (1 Post)
  73. iwagon (1 Post)
  74. psarunkumar (1 Post)
  75. kimmking (1 Post)
  76. sKuD24 (1 Post)
  77. MartinL (2 Posts)
  78. BitPoet (2 Posts)
  79. snoir (3 Posts)
  80. naranda (1 Post)
  81. zhw511006 (1 Post)
  82. bobjbain (1 Post)
  83. korto (1 Post)
  84. wp.joju (1 Post)
  85. hastiok (6 Posts)
  86. dtondo (4 Posts)
  87. Dumas (1 Post)
  88. vvreddy@12 (4 Posts)
  89. TheBim (1 Post)
  90. whodat (2 Posts)
  91. Skunkerbr (2 Posts)
  92. stevenhzj (4 Posts)
  93. Naokai (1 Post)
  94. wayned@escc (2 Posts)
  95. MuadDib-DK (1 Post)
  96. jsundquist (1 Post)
  97. hardc0re (2 Posts)
  98. hzwei (4 Posts)
  99. Galileo_Galilei (1 Post)
  100. SantaBarbarian (4 Posts)
  101. stevieke (1 Post)
  102. megmefleg (1 Post)
  103. Boccara Jonathan (1 Post)
  104. Surinder singh (2 Posts)
  105. KrullWarKing (1 Post)
  106. brandnewdrew (1 Post)
  107. MrRoyce (1 Post)
  108. Spongerusher (1 Post)
  109. teraphy (2 Posts)
  110. Pekka Karalahti (3 Posts)
  111. Sergii (1 Post)
  112. Cassio11 (1 Post)
  113. myth (1 Post)
  114. spor (6 Posts)
  115. StagnantIce (2 Posts)
  116. shailendra (2 Posts)
  117. ext_user1 (1 Post)
  118. kenny_mk (1 Post)
  119. mpacheco (1 Post)
  120. Centurus (1 Post)
  121. andyfly (1 Post)
  122. darmandovargas@gmail.com (1 Post)
  123. zjuthhy (3 Posts)
  124. robshim (3 Posts)
  125. Tod (1 Post)
  126. bipen (2 Posts)
  127. alisyah (1 Post)
  128. Monz87 (1 Post)
  129. alssst (1 Post)
  130. aggie (1 Post)
  131. bradelsky (1 Post)
  132. lagrezd (1 Post)
  133. ma1986 (1 Post)
  134. Sabareesh (2 Posts)
  135. top_1 (1 Post)
  136. Vasanthoo7 (1 Post)
  137. garrek99 (2 Posts)
  138. opik (1 Post)
  139. shankar8rajah1 (1 Post)
  140. tdobberphul (4 Posts)

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar